Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!ateng!chip From: chip@ateng.ateng.com (Chip Salzenberg) Newsgroups: comp.lang.c Subject: Re: Get this pointer stuff over with, people Message-ID: <1989May22.144051.11992@ateng.ateng.com> Date: 22 May 89 18:40:50 GMT References: <2747@buengc.BU.EDU> <10191@smoke.BRL.MIL> <406@skye.ed.ac.uk> <10276@smoke.BRL.MIL> <2890@buengc.BU.EDU> <10711@cit-vax.Caltech.Edu> <2909@buengc.BU.EDU> Organization: A T Engineering, Tampa, FL Lines: 23 According to bph@buengc.BU.EDU (Blair P. Houghton): >I'd also like to be able to add pointers as though they were data. Of course, there's the '286... [thrown tomatoes obscure the speaker] Ahem. As I was saying, on the '286 -- and also on the '386, though it seems that no one cares -- pointer values include both a segment portion and an offset portion. Arithmetic with pointer offsets is meaningful, but arithmetic with pointer segments is not. (One exception to that rule is the provision for "huge" arrays which span segments, but this provision is not standard C.) Further, when the '286 is in protected mode -- as it always is when running a Unix program -- the simple *assignment* of an invalid segment into a segment register causes a protection trap and a SIGSEGV. So there's really no way to perform integer-like arithmetic on a '286 pointer. -- Chip Salzenberg or A T Engineering Me? Speak for my company? Surely you jest! "It's no good. They're tapping the lines."