* Strange warning text
@ 2004-03-23 18:12 Christoph Rabel
2004-03-24 0:44 ` Felix Lee
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Rabel @ 2004-03-23 18:12 UTC (permalink / raw)
To: gcc-help
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Strange warning text
2004-03-23 18:12 Strange warning text Christoph Rabel
@ 2004-03-24 0:44 ` Felix Lee
2004-03-24 4:30 ` Christoph Rabel
0 siblings, 1 reply; 3+ messages in thread
From: Felix Lee @ 2004-03-24 0:44 UTC (permalink / raw)
To: Christoph Rabel; +Cc: gcc-help
Christoph Rabel <odie@hal9000.vc-graz.ac.at>:
> 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.
fixed in gcc 3.4
I think this is the relevant change:
http://gcc.gnu.org/ml/gcc-patches/2003-02/msg02468.html
--
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Strange warning text
2004-03-24 0:44 ` Felix Lee
@ 2004-03-24 4:30 ` Christoph Rabel
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Rabel @ 2004-03-24 4:30 UTC (permalink / raw)
To: gcc-help
Felix Lee wrote:
>Christoph Rabel <odie@hal9000.vc-graz.ac.at>:
>
>
>>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.
>>
>>
>
>fixed in gcc 3.4
>I think this is the relevant change:
>http://gcc.gnu.org/ml/gcc-patches/2003-02/msg02468.html
>
>
Thanx for your answer!
Christoph
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-03-24 0:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-23 18:12 Strange warning text Christoph Rabel
2004-03-24 0:44 ` Felix Lee
2004-03-24 4:30 ` Christoph Rabel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).