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

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!imagine.COM!henryf
  3. From: henryf@imagine.COM (Henry Flurry)
  4. Subject: Warnings and %-sequences
  5. Message-ID: <9211120430.AA10175@_imagine.com>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Wed, 11 Nov 1992 18:30:10 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 49
  12.  
  13. The program below generates the following warnings on NeXT's 3.0 compiler:
  14.  
  15.   stuff.c: In function `main':
  16.   stuff.c:17: warning: precision and `0' flag both used in one %-sequence
  17.   stuff.c:17: warning: precision and `0' flag both used in one %-sequence
  18.   stuff.c:17: warning: precision and `0' flag both used in one %-sequence
  19.   stuff.c:17: warning: precision and `0' flag both used in one %-sequence
  20.   stuff.c:17: warning: precision and `0' flag both used in one %-sequence
  21.  
  22. a) I don't have gcc2.3.  Does it make these warnings?
  23.  
  24. b) I don't understand the purpose of these warnings in my usage of the %f  
  25. sequence, although I see a potential purpose for them in a %d sequence.   
  26. Am I missing something?
  27.  
  28. c) If the warnings are valid, is there another way to code my %f sequence  
  29. so that I achieve the same results but don't get the warning?  (I want a  
  30. minimum of an XX.XX field, zero padded, with the ability to have the left  
  31. side expand)
  32.  
  33. - Thanks!
  34.  
  35. - Henry Flurry
  36.  
  37.  
  38. ### BEGIN ###
  39.  
  40.     /*
  41.     **    File: stuff.c
  42.     ** Compile: cc -Wall stuff.c -o stuff
  43.     **     Run: stuff
  44.     */
  45.  
  46. #include <stdio.h>
  47.  
  48. int main(void)
  49. {
  50.     printf("%05.2f\t%05.2f\t%05.2f\t%05.2f\t%05.2f\n",
  51.             (double)1.2,
  52.         (double)12.3,
  53.         (double)192834.39,
  54.         (double)0.004,
  55.         (double)10.01);
  56.     return 0;
  57. }
  58.  
  59. ### END ###
  60.  
  61.  
  62.