Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!news From: flee@guardian.cs.psu.edu (Felix Lee) Newsgroups: comp.std.c Subject: SIZE_T_MAX (Re: More fwrite limits) Message-ID: Date: 6 Jul 90 06:03:17 GMT References: <3159@disk.UUCP> <25096@mimsy.umd.edu> <13284@smoke.BRL.MIL> Sender: news@cs.psu.edu (Usenet) Organization: Penn State Computer Science Lines: 11 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@cs.psu.edu