Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!watmum!smvorkoetter From: smvorkoetter@watmum.UUCP Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: PC C compilers that handle more than 32 bits Message-ID: <1042@watmum.UUCP> Date: Fri, 26-Jun-87 12:58:40 EDT Article-I.D.: watmum.1042 Posted: Fri Jun 26 12:58:40 1987 Date-Received: Sat, 27-Jun-87 06:35:37 EDT References: <502@array.UUCP> <6459@steinmetz.steinmetz.UUCP> Reply-To: smvorkoetter@watmum.UUCP (Stefan M. Vorkoetter) Organization: U. of Waterloo, Ontario Lines: 49 Xref: utgpu comp.lang.c:2500 comp.sys.ibm.pc:4415 In article <6459@steinmetz.steinmetz.UUCP> davidsen@kbsvax.steinmetz.UUCP (William E. Davidsen Jr) writes: >In article <502@array.UUCP> len@array.UUCP (Leonard Vanek) writes: >> >>I have the source for a program that requires 32-bit integers and >>double precision floating point with more than 32 bits precision. >>I do not yet own a C compiler for my PC but wish to buy one that >>can handle this program. > >As far as I have seen, there are no compilers on the market which allow >32 bit ints. I would gladly buy one if there were. There are a number of >compilers which allow 32 bit *longs*, which is what you should use for >portability. The lack of 32 bit ints is only a problem if you have, say, >7 MB of source code for a VAX which assumes that int pointer. My problem exactly. I am currently attempting to port a large software package from a VAX to an IBM PC AT. The program makes extensive use of 32 bit ints (which could easily be changed to longs) but more importantly, uses them interchangeably with pointers. Even using longs won't help because the PC's address space is NOT linear. If I were to assign the values 0x00010000 and 0x00000010 to longs and compare them, they would obviously be unequal. As pointers however, they both point to the same memory location. MY SOLUTION: Given the Small C Compiler (public domain) and a lot of work, I have written a C Compiler (almost done) that completely hides the environment from the programs compiled with it. Ints are 32 bits, pointers are 32 bits, and completely interchangeable with ints. The linear-to-segmented addressing conversion and vice-versa is done at run-time. This makes things a bit slow, but it should be workable. The current version does NOT generate machine code; it generates parse trees, which are interpreted. Generating code is feasible, but will generate some very LARGE code. I will probably eventually have it generate some sort of threaded code. NOTE: Some features of full C are not supported, most notably structs and unions. Up to five levels of indirection are allowed, but arrays cannot be declared with more than one dimension. The compiler implements only those parts of C needed for the software package. Stefan Vorkoetter (smvorkoetter@watmum) Symbolic Computation Group University of Waterloo Waterloo, Ontario, CANADA The opinions herein are those of my self, not those of my employer, nor those of the people sharing my office, nor anyone else for that matter. Unauthorized use of these opinions is prohibited.