Welcome, Guest. Please login or register.

Author Topic: BADDR () ??  (Read 970 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2869
    • Show only replies by Jose
BADDR () ??
« on: June 29, 2005, 06:22:38 PM »
I stumbled acrross that function when reading some examples on AmigaMail2. There's no reference to it in the DevCD2.1 function reference list. Can someone clarify what it does, it seems to copy a file handle or something ?
\\"We made Amiga, they {bleep}ed it up\\"
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: BADDR () ??
« Reply #1 on: June 29, 2005, 08:16:19 PM »
Isn't it a macro to convert a BCPL pointer to a C pointer (or vice versa, I don't recall) ?

BCPL pointers *shudder* They're just totally wrong.

Alternatively it might be a function to create a HaroldShipman object....

/hides
int p; // A
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: BADDR () ??
« Reply #2 on: June 29, 2005, 08:57:18 PM »
Look into dos/dos.h, it has BADDR and MKBADDR macros.

BADDR is used to convert BPTR to APTR (* 4).
MKBADDR is used to convert APTR to BTPR (/ 4).
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: BADDR () ??
« Reply #3 on: June 29, 2005, 09:03:41 PM »
Quote

Piru wrote:

BADDR is used to convert BPTR to APTR (* 4).
MKBADDR is used to convert APTR to BTPR (/ 4).


Like I said, wrong. Evil, infact, :lol:
int p; // A
 

Offline Thomas

Re: BADDR () ??
« Reply #4 on: June 30, 2005, 02:00:08 PM »
Quote

Karlos wrote:
Like I said, wrong. Evil, infact, :lol:


Well, with a BPTR you could theoretically address up to 16 GB of memory as opposed to the 4GB of a usual C pointer. Of course the processor architecture has to support it.

Bye,
Thomas


Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2869
    • Show only replies by Jose
Re: BADDR () ??
« Reply #5 on: June 30, 2005, 05:21:00 PM »
@All

Yes!! :-D
\\"We made Amiga, they {bleep}ed it up\\"
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: BADDR () ??
« Reply #6 on: June 30, 2005, 06:03:58 PM »
Quote

Thomas wrote:
Quote

Karlos wrote:
Like I said, wrong. Evil, infact, :lol:


Well, with a BPTR you could theoretically address up to 16 GB of memory as opposed to the 4GB of a usual C pointer. Of course the processor architecture has to support it.

Bye,
Thomas



Well, first off there's nothing in C that says a pointer is 32 bits. This is a machine implementation. Secondly, the 68K has this particular 32-bit pointer implementation anyway, so the BPTR offers nothing. Lastly, I don't know of any common architectures that do perform this kind of n*sizeof(element) type addressing so in most cases, it's simply a total waste of cycles to store it in this fashion when at best you are going to have to shift it every time you want to dereference it ;-)

As I said. BCPL pointers are wrong, evil and they smell too :lol:
int p; // A