Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site harvard.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!breuel From: breuel@harvard.ARPA (Thomas M. Breuel) Newsgroups: net.lang.c Subject: Re: lint, pointers, 0 (what else?) Message-ID: <374@harvard.ARPA> Date: Sat, 9-Feb-85 02:17:38 EST Article-I.D.: harvard.374 Posted: Sat Feb 9 02:17:38 1985 Date-Received: Sun, 10-Feb-85 05:37:27 EST References: <366@harvard.ARPA> <8094@brl-tgr.ARPA> Distribution: net Organization: Harvard University Lines: 55 > > [no good reason for sizeof(int)!=sizeof(char *)] > > Yes there is! There is no good reason for you to be too lazy to allow it. > C is a systems programming language. I balk at having it bastardized into > > STOP RUINING C FOR SYSTEMS PROGRAMMING. Exactly. In a systems programming language I expect to have one (pre-defined) integer type which can hold a pointer. 'C' *is* ruined in that way that the kind of integer that can hold a pointer is not pre-defined. This lack is not quite as noticable in 'C' as it is in Pascal, for example, since you can do arithmetic with pointers easily in 'C', without converting them to integers first. Of course you can 'typedef' such an integer type yourself. I would prefer the integer type to be an 'int', and I still maintain that that does not cause significant inefficiencies (being aware of forwarding to 'int' on procedure calles, ...). I would prefer it to be an 'int', because that is what many programs expect, and because there are certain notational conveniences extended to the 'int' type. Other alternatives are to have the compiler pre-declare an integer type (e.g. 'address') or to allow the programmer to re-declare 'int' to be *any* integer data type. > > The way K&R intended (and partially documented it). > > It isn't clear that they ever intended it to work this way. Ok, I don't know whether K&R *intended* to work '0' as the nil pointer on function call. Looking at 'stdio' and at V7 UN*X programs I just can't help getting that impression, though. > > While we are on the > > subject, what about the same treatment for '-1', the (de facto) standard > > error return value? > > Why not say that all integers are mappable to pointers, hey lets do away > with types at all! Yes, there should by an integer type such that (AnyPointerType)(AddressIntegerType)(AnyPointerType)(exp)==(exp) is always true. That's something I expect in a systems programming language. Looking at my assembly language programs, I find that I end up doing 95% of all operations with one data type: address (here meant to refer to the integer type that can hold an address, i.e. 32bits on a 68000). Maybe 4% are done with characters, and the remaining 1% with other types. I would be perfectly happy with a systems programming language that has only one data type: address. Such languages exist and are moderately successful. Unfortunatly, they are not widely available in the UN*X world or on micros. Thomas.