🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #3279

Re: What's an APTR, BPTR?

#3279
From: Deven T. Corzine
Date: Thu, 12 Apr 1990 09:10
43 lines
2213 bytes
On 11 Apr 90 10:34:19 GMT, mapjilg@bath.ac.uk (J I L Gold) said:

mapjilg> OK, now I know what these are, what is a CPTR ?

From <exec/types.h>:
--
typedef unsigned long	ULONG;	    /* unsigned 32-bit quantity */
typedef unsigned char	*STRPTR;    /* string pointer */
typedef STRPTR		*APTR;	    /* absolute memory pointer */

/* sigh.  APTR was misdefined, but compatibility rules.	 Heres what it
 * should have been
 */
typedef ULONG		CPTR;	    /* absolute memory pointer */

typedef unsigned char	TEXT;
--

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.

*sigh*

Deven
-- 
Deven T. Corzine        Internet:  deven@rpi.edu, shadow@pawl.rpi.edu
Snail:  2151 12th St. Apt. 4, Troy, NY 12180   Phone:  (518) 274-0327
Bitnet:  deven@rpitsmts, userfxb6@rpitsmts     UUCP:  uunet!rpi!deven
Simple things should be simple and complex things should be possible.
Technical Details
Message-ID: <DEVEN.90Apr12051138@netserv2.rpi.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!rpi!netserv2!deven
References: <3421@newton.physics.purdue.edu> <10712@cbmvax.commodore.com> <1990Apr11.103419.29002@bath.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!rpi!netserv2!deven
From: deven@rpi.edu (Deven T. Corzine)
Newsgroups: comp.sys.amiga.tech
Subject: Re: What's an APTR, BPTR?
Message-ID: <DEVEN.90Apr12051138@netserv2.rpi.edu>
Date: 12 Apr 90 09:10:49 GMT
References: <3421@newton.physics.purdue.edu> <10712@cbmvax.commodore.com>
 <1990Apr11.103419.29002@bath.ac.uk>
Distribution: comp.amiga.tech
Organization: Rensselaer Polytechnic Institute, Troy, NY
Lines: 43
In-Reply-To: mapjilg@bath.ac.uk's message of 11 Apr 90 10:34:19 GMT