Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!jarthur!usc!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!psuvm!dn5 From: DN5@psuvm.psu.edu Newsgroups: comp.sys.mac.programmer Subject: Re: Trouble with using Munger Message-ID: <90197.101035DN5@psuvm.psu.edu> Date: 16 Jul 90 14:10:35 GMT References: <477@psych.psy.uq.oz.au> <42915@apple.Apple.COM> <11122@claris.com> <42936@apple.Apple.COM> <9135@goofy.Apple.COM> Organization: Penn State University Lines: 35 In article <9135@goofy.Apple.COM>, dowdy@apple.com (Tom Dowdy) says: >This is actually caused by the fact that Pascal will store a char as a >short. @Char is giving you a pointer to the high order byte, which is NOT >where the data is, it's in the low order byte. > >So, Ptr(ORD(@Char)+1) is the right way to pass a pointer to a char in Pascal. > >Keith had the right idea, but the wrong reason. The real reason why this >doesn't work is that Pascal sucks. :-) > > Tom Dowdy Internet: dowdy@apple.COM > Apple Computer MS:81EQ UUCP: {sun,voder,amdahl,decwrl}!apple!dowdy Actually, I don't believe that the definition of Pascal says that you have to put a CHAR into the low order byte. Even if it did, I would think that the correct thing for the compiler to do would be to get the correct address with the @ operator. Not doing so seems a bug, because now getting the address of an element of a PACKED ARRAY OF CHAR is somehow different from getting the address of a normal CHAR. Perhaps Apple's Pascal should have put the CHAR into the high-order byte, in order to make this come out better? On the other hand, this might generate slightly more code. Which is better, generating more efficient code, or having the compiler work the way that it looks like it should...? (no smiley) In any case, it should be documented somewhere. If not, that is truely a BUG (in the documentation). ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()() D. Jay Newman ! All syllogisms have three parts, dn5@psuvm.psu.edu ! therefore this is not a syllogism. CBEL--Teaching and Learning Technologies Group