home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / sgi / bugs / 36 < prev    next >
Encoding:
Text File  |  1992-12-23  |  1.4 KB  |  49 lines

  1. Newsgroups: comp.sys.sgi.bugs
  2. Path: sparky!uunet!spool.mu.edu!darwin.sura.net!sgiblab!sgigate!sgi!quasar.mti.sgi.com!davea
  3. From: davea@quasar.mti.sgi.com (David B.Anderson)
  4. Subject: Re: c-compiler false diagnostic.
  5. Message-ID: <tvk5d44@sgi.sgi.com>
  6. Sender: davea@quasar.mti.sgi.com
  7. Organization: Silicon Graphics, Inc.  Mountain View, CA
  8. Date: Wed, 23 Dec 1992 21:32:10 GMT
  9. Lines: 38
  10.  
  11. In article <1992Dec23.163608.24772@bernina.ethz.ch> hoesel@igc.ethz.ch (Frans van Hoesel) writes:
  12. >Hi ,
  13. >
  14. >the c compiler on my indigo (4.0.1) gives the following warning on the
  15. >following program.
  16. >#include <stdio.h>
  17. >
  18. >int main() {
  19. >
  20. >        int i;
  21. >        int p[] = { 1,2,3,4,5};
  22. >        for (i = 0; i<5; i++ ) printf("%d ", p[i]);
  23.                                                    ^
  24. >        ;
  25. >        return 0;
  26. >}
  27. >
  28. >> cc -fullwarn -ansi t4.c
  29. >accom: Warning 302: t4.c, line 8: bodyless for statement
  30. >        ;
  31. >       -^
  32. >
  33. >This seems incorrect to me. (the warning I got was the result from some
  34.  
  35. The line it shows is, clearly, wrong (the scanner has already gotten to
  36. the next line by the time the parser has recognized the situation).  On
  37. the other hand, the preceeding for is bodyless.
  38.  
  39. FYI:
  40. If you use {} instead of ; after the 'for()' the message will vanish,
  41. since  {} stands out enough that it is surely not a normal human typing 
  42. mistake.
  43.  
  44. Sorry about the line shown being the wrong line....
  45. [ David B. Anderson             (415)390-4263             davea@sgi.com ]
  46.  
  47.  
  48.  
  49.