SIZE_T_MAX (Re: More fwrite limits)

Felix Lee flee at guardian.cs.psu.edu
Fri Jul 6 16:03:17 AEST 1990


Without something like SIZE_T_MAX, it can be hard to write portable
programs that behave sensibly on various overflow conditions.  Here
are some innocuous statements that can run into trouble, especially
when size_t is 16 bits:
	s = malloc(strlen(a) + strlen(b) + 1);
	c = n * sizeof(x);

I'd also like to have PTRDIFF_T_MIN and PTRDIFF_T_MAX and WCHAR_T_MAX
and....  To bad there isn't something similar to Ada's INTEGER'LAST.
--
Felix Lee	flee at cs.psu.edu



More information about the Comp.std.c mailing list