home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:16762 comp.std.c:3031
- Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!stanford.edu!agate!doc.ic.ac.uk!uknet!acorn!ixi!clive
- From: clive@x.co.uk (Clive Feather)
- Newsgroups: comp.lang.c,comp.std.c
- Subject: Re: Idle Questions about ANSI C
- Message-ID: <1992Nov18.122631.22438@x.co.uk>
- Date: 18 Nov 92 12:26:31 GMT
- References: <1992Nov13.213708.5456@mccc.edu> <1992Nov14.162633.13199@taumet.com>
- Followup-To: comp.std.c
- Organization: IXI Limited, Cambridge, UK
- Lines: 28
-
- [Crossposted to comp.std.c - followups there please]
-
- In article <1992Nov14.162633.13199@taumet.com> steve@taumet.com (Steve Clamage) writes:
- > pjh@mccc.edu (P. J. Holsberg) writes:
- >> 1) Is "size_t" ever not the same as "unsigned int"? If so, in what situation?
- > If the address space is large but ints are small, size_t will be unsigned
- > long. If address space is small but ints are large, you might want to
- > make size_t an unsigned short. I've seen implementations like the first
- > case. The second case seems unlikely. Both could be Standard-conforming.
-
- As far as I can tell, the second case is Standard-conforming. However,
- the Rationale says (4.1.6):
- | All library prototypes are specified in terms of the "widened" types:
- | an argument formerly declared as char is now written as int. This
- | ensures that most library functions can be called with or without a
- | prototype in scope.
- (and then goes on to point out that varargs functions need a prototype).
-
- However, this is not true for malloc if size_t is unsigned short, and:
-
- extern void *malloc ();
-
- causes undefined behaviour.
- --
- Clive D.W. Feather | IXI Limited | If you lie to the compiler,
- clive@x.co.uk | Vision Park | it will get its revenge.
- Phone: +44 223 236 555 | Cambridge CB4 4RZ | - Henry Spencer
- Fax: +44 223 236 550 | United Kingdom |
-