Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 683 Vote(s) - 3.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Operation on ... may be undefined?

#1
I have the following code

FRAME frameArray[5][10]; // Create the array of frames
int trackBufferFull[5] = {0, 0, 0, 0, 0};// Keeps track of how full the buffer for each node is
int trackFront[5] = {0, 0, 0, 0, 0}; // Array to keep track of which is the front of the array
int trackTail[5] = {0, 0, 0, 0, 0};


// Function to add to the array (CHANGE int frame)
void addFrame (int nodeNumber, FRAME frame)
{
//Calc tail
int tail = trackTail[nodeNumber-1];

// Calc frames in buffer
int framesinBuffer = trackBufferFull[nodeNumber-1];

if (framesinBuffer == 10)
{
printf("Buffer is full\n");
}
else
{

// Add frame to frameArray
frameArray[nodeNumber-1][tail] = frame;
printf("\nAdded a frame in node: %i to the buffer\n", nodeNumber);

// Increment the count
trackBufferFull[nodeNumber-1]++;
trackTail[nodeNumber-1] = ++trackTail[nodeNumber-1] % 10;


}
}

The arrays I use for frameArray is a wrap-around/cyclic array of length 10, hence why I have the code

trackTail[nodeNumber-1] = ++trackTail[nodeNumber-1] % 10;


Everything works perfectly in a standalone file, however when run inside of a larger file, I get the following compile errors:

$ cnet GARETH -m 30
compiling gareth.c
gareth.c: In function ‘addFrame’:
gareth.c:77:27: error: operation on ‘trackTail[nodeNumber + -0x00000000000000001]’ may be undefined [-Werror=sequence-point]
gareth.c: In function ‘removeFirstFrame’:
gareth.c:98:28: error: operation on ‘trackFront[nodeNumber + -0x00000000000000001]’ may be undefined [-Werror=sequence-point]
gareth.c:105:1: error: control reaches end of non-void function [-Werror=return-type]
cc1: all warnings being treated as errors

Line 77 is the line

trackTail[nodeNumber-1] = ++trackTail[nodeNumber-1] % 10;

Help.

To see the code with line numbers and the errors side by side, I've uploaded an image to:
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through