This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Strange warning text


Hi!

Compiling the following program with -Wall

struct MyType{};

int main()
{
 int size = 0;
 int temp1[size];
}

I get the following warning:

x12.cpp: In function `int main()':
x12.cpp:6: warning: unused variable `int temp1[((size - 1) + 1)]'

I was rather surprised by "((size - 1) + 1)" part.

While this is a rather unimportant issue I would be interested to know why 1 is subtracted and then added again. I see no sense in this and really would like to get an explanation for this warning text.

Thx very much!

Christoph


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]