🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sgi.bugs
Article #24

Re: c-compiler false diagnostic.

#24
From: David B.Anderson
Date: Wed, 23 Dec 1992 21:32
35 lines
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 ]
Technical Details
Message-ID: <tvk5d44@sgi.sgi.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!darwin.sura.net!sgiblab!sgigate!sgi!quasar.mti.sgi.com!davea

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.sgi.bugs
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!darwin.sura.net!sgiblab!sgigate!sgi!quasar.mti.sgi.com!davea
From: davea@quasar.mti.sgi.com (David B.Anderson)
Subject: Re: c-compiler false diagnostic.
Message-ID: <tvk5d44@sgi.sgi.com>
Sender: davea@quasar.mti.sgi.com
Organization: Silicon Graphics, Inc.  Mountain View, CA
Date: Wed, 23 Dec 1992 21:32:10 GMT
Lines: 38