Thread View: comp.sys.sgi.bugs
1 messages
1 total messages
Started by David B.Anderson
Wed, 23 Dec 1992 21:32
Re: c-compiler false diagnostic.
Author: David B.Anderson
Date: Wed, 23 Dec 1992 21:32
Date: Wed, 23 Dec 1992 21:32
35 lines
1516 bytes
1516 bytes
In article <1992Dec23.163608.24772@bernina.ethz.ch> hoesel@igc.ethz.ch (Frans van Hoesel) writes:
>Hi ,
>
>the c compiler on my indigo (4.0.1) gives the following warning on the
>following program.
>#include <stdio.h>
>
>int main() {
>
> int i;
> int p[] = { 1,2,3,4,5};
> for (i = 0; i<5; i++ ) printf("%d ", p[i]);
^
> ;
> return 0;
>}
>
>> cc -fullwarn -ansi t4.c
>accom: Warning 302: t4.c, line 8: bodyless for statement
> ;
> -^
>
>This seems incorrect to me. (the warning I got was the result from some
The line it shows is, clearly, wrong (the scanner has already gotten to
the next line by the time the parser has recognized the situation). On
the other hand, the preceeding for is bodyless.
FYI:
If you use {} instead of ; after the 'for()' the message will vanish,
since {} stands out enough that it is surely not a normal human typing
mistake.
Sorry about the line shown being the wrong line....
[ David B. Anderson (415)390-4263 davea@sgi.com ]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads