home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12305 < prev    next >
Encoding:
Text File  |  1992-08-13  |  1.8 KB  |  39 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!munnari.oz.au!metro!mama!greyham
  3. From: greyham@research.canon.oz.au (Graham Stoney)
  4. Subject: I wish ANSI-C sizeof (void) == 1 (was Re: preprocessing subterfuge)
  5. Message-ID: <BswME5.6Mp@research.canon.oz.au>
  6. Sender: news@research.canon.oz.au
  7. Organization: Canon Information Systems Research Australia
  8. References: <1992Aug9.144525.4521@taumet.com> <23277A@erik.naggum.no> <1992Aug10.031337.4424@druid.uucp> <1992Aug11.202135.28878@ugle.unit.no>
  9. Date: Thu, 13 Aug 1992 04:13:16 GMT
  10. Lines: 27
  11.  
  12. toriver@flipper.pvv.unit.no (Tor Iver Wilhelmsen) writes:
  13.  
  14. >In article <1992Aug10.031337.4424@druid.uucp> darcy@druid.uucp (D'Arcy J.M. Cain) writes:
  15. >>Gnu C with -Wall -ansi -pedantic has a pretty tight sphincter.
  16.  
  17. >May be, but it still insists on assigining a size of 1 (one) to the type void,
  18. >which according to the parts of the standards I have seen, is an incomplete type.
  19. >Thus you get a warning:
  20. >void.c:3: warning: sizeof applied to a void type
  21.  
  22. When I first heard of GNU C's deviation from the standard with the sizeof type
  23. 'void', I thought it was a bad idea; but now I hope ANSI will standardise it
  24. next time around. void * is the natural type to use when you're considering a
  25. pointer to a chunk of memory that can hold any arbitrary type; in the Unix
  26. kernel for instance it seems a natural replacement for caddr_t. And any time
  27. I need to do arithmetic on one, it's always in terms of bytes - it would be
  28. great to be able to not have to cast to char * every time you need to do
  29. arithmetic on one, which seems to happen quite a lot in stuff like device
  30. drivers.
  31.  
  32. Any comments?
  33.  
  34. Graham
  35. -- 
  36. Graham Stoney                    | "a Perl script is correct if it's halfway
  37. Flip Dibner fan club, "Hi Flip!" |  readable and gets the job done before your
  38. Ph: +61 2 805-2909  Fax: -2929   |  boss fires you." L. Wall & R. Schwartz
  39.