home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18749 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.6 KB

  1. Xref: sparky comp.lang.c:18749 comp.unix.bsd:10508
  2. Path: sparky!uunet!dtix!darwin.sura.net!bogus.sura.net!pandora.pix.com!stripes
  3. From: stripes@pix.com (Josh Osborne)
  4. Newsgroups: comp.lang.c,comp.unix.bsd
  5. Subject: Re: Segmentation faults
  6. Message-ID: <BzMFF4.Aut@pix.com>
  7. Date: 21 Dec 92 18:01:51 GMT
  8. References: <1gricmINNsl@ub.d.umn.edu> <1992Dec18.134225.20548@Logix.DE> <veit.724925472@du9ds3>
  9. Sender: news@pix.com (The News Subsystem)
  10. Organization: Pix Technologies -- The company with no adult supervision
  11. Lines: 22
  12. Nntp-Posting-Host: pandora.pix.com
  13.  
  14. In article <veit.724925472@du9ds3> veit@du9ds3.fb9dv.uni-duisburg.de writes:
  15. [...]
  16. >This is a real problem where sizeof(int) != sizeof(char*), for instance with
  17. >Turbo C or Microsoft C or similar 16bit junk. But if you compile this
  18. >with a 32bit K&R compiler, and sizeof(int)==sizeof(char*) (=4), it won't see 
  19. >a difference, because it will just take 32bit from the parameter stack 
  20. >and push it as a 32bit argument to printf.
  21.  
  22. (which masks many bugs, which will show up on, say the Alpha)
  23.  
  24. >The compiler cannot find out the real expected type (it cannot do parsing
  25. >of the format string in general!).
  26.  
  27. Not in general, but gcc CAN verify printf/scanf style args and parms as
  28. long as the format string is a constant.  See __attribute__ in the gcc
  29. manual.
  30. -- 
  31.            stripes@pix.com              "Security for Unix is like
  32.       Josh_Osborne@Real_World,The          Multitasking for MS-DOS"
  33.       "The dyslexic porgramer"                  - Kevin Lockwood
  34. We all agree on the necessity of compromise.  We just can't agree on
  35. when it's necessary to compromise.       - Larry Wall
  36.