Path: utzoo!attcan!uunet!tektronix!tekcae!kurtk From: kurtk@tekcae.CAX.TEK.COM (Kurt Krueger) Newsgroups: comp.lang.c Subject: Re: C union problems (or is a pointer a pointer?) Keywords: C, Pascal, pointer, union, variant Message-ID: <2700@tekcae.CAX.TEK.COM> Date: 26 Apr 89 15:43:17 GMT References: <15058@sequent.UUCP> Reply-To: kurtk@tekcae.CAX.TEK.COM (Kurt Krueger) Organization: Tektronix, Inc., Beaverton, OR. Lines: 26 On 'real' computers a pointer is generally an absolute virtual memory address. Casting a pointer is really a NOP, it is only done to keep the compiler happy (and an attempt to convey that you REALLY know what you are doing). So in this case, a pointer is a pointer regardless of what it points to. Now, enter the 80287 (i.e IBM PC). It takes TWO (2, count 'em) 16 bit quantities to specify a memory address and the formula goes something like address = segment*16 + offset. Borland has implemented three pointer types in an attempt to maintain speed but yet address all of memory if possible. 'Near' pointers are just the offset, 'far' pointers are both, but since several combinations of segment and offset can reference the same address, they have 'huge' pointers which are just normalized far pointers. In this case a pointer is nowhere near a pointer. I think you're better off 'unionizing' your pointers and living with the additional annoyance of union1.union2.pointer. Makes brain damaged processors more likely to work with your code. ________________________________________________________________________________ | kurtk@tekcae.CAX.TEK.COM (Kurt Krueger) | Everything runs on smoke. When the Electrical Simulation Group (ECAX) | smoke leaks out, it stops working. D.S. 59-432 (503) 627-4363 | ________________________________________|_______________________________________