Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!gatech!mcnc!rti!xyzzy!throopw From: throopw@xyzzy.UUCP Newsgroups: comp.lang.c,comp.unix.wizards Subject: Re: pointer alignment when int != char * Message-ID: <243@xyzzy.UUCP> Date: Tue, 1-Sep-87 14:57:09 EDT Article-I.D.: xyzzy.243 Posted: Tue Sep 1 14:57:09 1987 Date-Received: Thu, 3-Sep-87 00:41:09 EDT References: <493@its63b.ed.ac.uk> <6061@brl-smoke.ARPA> <3812@spool.WISC.EDU> <7939@think.UUCP> <588@murphy.UUCP> Organization: Data General, RTP NC. Lines: 26 Xref: utgpu comp.lang.c:3916 comp.unix.wizards:3726 > dave@murphy.UUCP (Dave Cornutt) > However, I will say this, because I don't > think the standard has really addressed it: there should be a way to take > any pointer and generate a byte offset from byte 0 in whatever address > space the code is running in. The reason is that you need such a beast > to feed to lseek if you want to access something through one of the > /dev/mem devices (or maybe /proc). By "the standard", I presume draft X3J11 is meant. First, the C language standard had better say nothing that requires there to even *BE* a single, linear address space in which "code is running". There are many machines where this isn't a well-founded presumption. Thus the whole idea of a process-unique "byte 0", or "a byte offset" from there may not be present in the hardware for which the C source is being compiled. To say nothing of whether a C language standard should be talking about "lseek" and "/dev/mem" in its rationale for a general feature. In fact, "the standard" says just about what it ought to say. It gives liscence to developers for whom it is natural to supply "byte offsets from byte 0" to supply them, but does not require it from those developers for whom it is an impossibility. -- 1+1=3, for sufficently large values of 1. -- Wayne Throop !mcnc!rti!xyzzy!throopw