Path: utzoo!utgpu!watserv1!watmath!att!tut.cis.ohio-state.edu!snorkelwacker!apple!netcom!mcmahan From: mcmahan@netcom.UUCP (Dave Mc Mahan) Newsgroups: comp.sys.amiga.tech Subject: Re: What's an APTR, BPTR? Message-ID: <10923@netcom.UUCP> Date: 13 Apr 90 04:41:15 GMT References: <3421@newton.physics.purdue.edu> <10712@cbmvax.commodore.com> <1990Apr11.103419.29002@bath.ac.uk> Distribution: comp.amiga.tech Organization: NetCom- The Bay Area's Public Access Unix System Lines: 33 In article deven@rpi.edu (Deven T. Corzine) writes: > > >So, as you can see, CPTR is a "fixed" APTR typedef. Unfortunately, it >is still misdefined. Properly, APTR should be defined as: > >typedef VOID *APTR; /* absolute memory pointer */ > >which is a generic pointer. The original APTR ended up being an >unsigned char **, which is clearly wrong. The "fixed" CPTR is an >unsigned long, which is actually worse, since APTR is at least a >pointer. (just a pointer to a pointer) CPTR is not a pointer, so if >the pointers in the machine were, say, 64 bits, a CPTR would be the >wrong size, but an APTR would not. > >All of this is somewhat academic at this point, since all three forms >work within the present architecture -- they all resolve to a 4-byte >(longword) value. Still, both "official" definitions are wrong. > The only problem I have run into with this is when doing pointer arithmatic. Doing things like incrementing a pointer tends to give different results, depending on if you use APTR, CPTR, or whatever. I usually just use casts to keep my compiler from barfing and then make it whatever I want it to be within the declaration of my program. >*sigh* > >Deven double sigh, -dave