home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / gnu / gcc / bug / 2731 < prev    next >
Encoding:
Text File  |  1992-11-12  |  987 b   |  41 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!clio.rice.edu!rhr
  3. From: rhr@clio.rice.edu (Rush Record 713-864-1574)
  4. Subject: gcc 2.3.1 warning bug?
  5. Message-ID: <009637a2.7a8a1de0.2253@clio.rice.edu>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Thu, 12 Nov 1992 04:35:48 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 28
  12.  
  13. The following program was compiled with gcc on a sparc II running
  14. SunOS 4.1.1, using gcc version 2.3.1, compiled by itself, as follows:
  15.  
  16. gcc -Wall -c test.c
  17.  
  18. #include <stdio.h>
  19. int main(char *buf)
  20. {
  21.     char c,*p;
  22.  
  23.     p = buf;
  24.     while(c = *p++)
  25.         printf("%c",c);
  26.     return(1);
  27. }
  28.  
  29. The result was:
  30.  
  31. test.c: In function `main':
  32. test.c:7: warning: suggest parentheses around assignment used as truth value
  33. test.c:8: warning: implicit declaration of function `printf'
  34.  
  35. There are already parentheses around the assignment. Must I use:
  36.  
  37.     while((c = *p++))
  38.     
  39. everywhere in my code?
  40.  
  41.