From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 4659 invoked from network); 22 Jun 1998 19:32:42 -0000 Received: from ellpspace.math.ualberta.ca (michal@129.128.88.19) by mail2.redhat.com with SMTP; 22 Jun 1998 19:32:42 -0000 Received: (from michal@localhost) by ellpspace.math.ualberta.ca (8.8.8/8.8.8) id NAA11327 for axp-list@redhat.com; Mon, 22 Jun 1998 13:32:25 -0600 From: Michal Jaegermann Message-Id: <199806221932.NAA11327@ellpspace.math.ualberta.ca> Subject: Re: Making programs 64 bit clean To: axp-list@redhat.com Date: Mon, 22 Jun 1998 13:32:25 -0600 (MDT) In-Reply-To: <199806221735.NAA13258@adder.cs.Virginia.EDU> from "Greg Lindahl" at Jun 22, 98 01:35:52 pm Content-Type: text Greg Lindahl writes: > > This is the easiest way to fix broken code. However, it isn't > necessarily portable to other 64 bit machines -- I think everyone > else (?) defines long == 32 bits and long long == 64 bits. This "everyone else" does not include Digital Unix, for example, nor Sparc Linux. Maybe there are some examples in this category but I do not know them (NT on Alpha is 32 bit - in case you wonder). > Your best bet for a clean, easy solution is to typedef an int64 type > and use that, with an appropriate definition for each machine. If you have rely on some type widths then the above is much better. C Standard says only that short is not wider than int and int is not wider than long. Nothing more! It does not even guarantees that there exists an integer type with the same 'sizeof' as a pointer. For overlaying objects of different types C provides a union construct which is, traditionally, grossly underutilized. > It's much better in the long run to fix the programs to not cast > pointers to ints of any width, but of course that is much more > expensive than this quick hack. Agreed. Unfortunately X, for example, uses pointers all over the place as "universal containters" and there is no good way to change that. I strongly suspect that recent problems with servers which work only in 8 colours have something to do with that. Michal