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