new standard for malloc() suggested

Doug Gwyn gwyn at brl-smoke.ARPA
Tue Dec 16 03:01:53 AEST 1986


In article <1790 at batcomputer.tn.cornell.edu> braner at batcomputer.UUCP (braner) writes:
>Aha, now that we've been reminded of the low ceiling for malloc()'s
>argument (an unsigned int, which on some systems is only 16 bits):

On such systems, you already have problems with sizeof.  X3J11
has defined a new typedef size_t, which is the unsigned integral
type of the result of sizeof (perhaps (unsigned long)).  Malloc()'s
argument has been defined to have type size_t, which solves the
problem.  Undoubtedly there are some implementations which didn't
face up to this issue before that now have to choose between
supporting existing application code as-is or changing sizeof and
malloc() to use the new type.  Many of those implementors are on
the X3J11 committee and have already "bought into" this decision.



More information about the Comp.lang.c mailing list