Xref: utzoo comp.sys.ibm.pc:22982 comp.sys.intel:653 Path: utzoo!attcan!uunet!lll-winken!ames!ncar!gatech!rutgers!apple!vsi1!daver!lynx!m5 From: m5@lynx.uucp (Mike McNally) Newsgroups: comp.sys.ibm.pc,comp.sys.intel Subject: Re: correct code for pointer subtraction Keywords: C pointer math has machine dependent limitations Message-ID: <5178@lynx.UUCP> Date: 9 Jan 89 20:26:43 GMT References: <597@mks.UUCP> <3845@pt.cs.cmu.edu> <18123@santra.UUCP> <6604@killer.DALLAS.TX.US> <9878@drutx.ATT.COM> Reply-To: m5@lynx.UUCP (Mike McNally) Organization: Lynx Real-Time Systems Inc, Campbell CA Lines: 17 In article <9878@drutx.ATT.COM> mayer@drutx.ATT.COM (gary mayer) writes: >I grant that this is probably not the answer you would like, but it >is the answer you should expect once pointer arithmetic is understood. Pointer subtraction is understood. According to the C definition, the statement should work. If it does not, then the compiler is busted. I don't give a crap why it doesn't work, or what sort of architectural problem the compiler writer had to deal with. If a translator for a language exists on a machine, it should translate programs into a form that executes correctly on the target machine, or at least inform the operator that a problem exists. That's the whole point of a high level language. -- Mike McNally Lynx Real-Time Systems uucp: {voder,athsys}!lynx!m5 phone: 408 370 2233 Where equal mind and contest equal, go.