From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 102b75,85404311f8041f7a X-Google-Attributes: gid102b75,public X-Google-Thread: 1164f8,5747331edea7cbab X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 2001-07-24 06:27:50 PST Newsgroups: comp.sys.dec,comp.arch Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.mathworks.com!news.mathworks.com!uunet!ash.uu.net!world!clj From: Chris Jones Subject: sizes of integral types in C [Re: using memory beyond the "top" of stack] Sender: clj@world.std.com (Chris Jones) Message-ID: Date: Tue, 24 Jul 2001 13:25:38 GMT References: <994616870.688233@haldjas.folklore.ee> <9iuka3$rku$1@mach.thp.univie.ac.at> <9j0jts$r2u$1@sword.avalon.net> <1bn163xzf0.fsf@cs.nmsu.edu> <9j5fd2$bgu$1@sword.avalon.net> <1br8vdbokt.fsf@cs.nmsu.edu> <3b56e0ad.662709412@News.CIS.DFN.DE> <995553466.29686@haldjas.folklore.ee> Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.3/Emacs 19.34 Followup-To: comp.arch Xref: archiver1.google.com comp.sys.dec:6102 comp.arch:14504 Sander Vesik writes: > > In comp.arch Dave Hansen wrote: > > On 18 Jul 2001 21:11:14 -0600, Joe Pfeiffer > > wrote: > > > [...] > >>``int'' isn't longest integral type, ``long int'' is (long long int > >>never made it into ANSI, did it? If it did, I'll stand corrected). > > > You stand corrected. In C99, "long long" is guaranteed to be a 64-bit > > type. The new longest int is intmax_t. > > Is it really *guranteed* to be 64 bits? So what do you call a 128bit type > made up of two 64 bit halves? What if you do have 128 bit types in hardware? The number of bugs caused by programmers "knowing" that C defines char, short, int, long (and now, God forbid, that long long atrocity) to be 8, 16, 32, and 32 bits long is mind-boggling. For as far back as I can recall, the only guarantee that C made was that a long was not shorter than a short. When I was a KSR-1 kernel developer, we had a compiler for which short was 16, int 32, and long 64, and a pointer was 40 bits. The amount of Unix code that assumed that sizeof(int) == sizeof(long) and sizeof() == sizeof(int) was mind-boggling -- we spent months (maybe even years) stomping out bugs caused by this brain-damage. I recall we finally moved the kernel's address space base to 0xf800000000 to more quickly catch all the bugs that assumed that pointers and ints were the same size.