Welcome, Guest. Please login or register.

Author Topic: Where's da bug  (Read 3209 times)

Description:

0 Members and 1 Guest are viewing this topic.

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: Where's da bug
« Reply #14 from previous page: September 01, 2004, 03:09:08 AM »
This struct MsgPort * return value is some good'ol BCPL legacy. BCPL CreateProc returns this, and so does the old dos function.

Actually BCPL considered address of Process' pr_MsgPort to be "process pointer" rather than 'struct Process *'. Processes were referenced by their pr_MsgPort address, too. Also address of various other pr_#? fields were calculated relative to pr_MsgPort, which gave some rather funky negative or positive offsets.
 

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: Where's da bug
« Reply #15 on: September 01, 2004, 03:15:31 AM »
Quote
Shouldn't that be a long instead of a byte?

No, it must be byte. If it was long, the ptr artith calculations would be *sizeof(long).

You're obviously mixing it with (SOMEPTRTYPE) (((ULONG) x) + y). Using (UBYTE *) or (char *) is better since it will work correctly regardless of arch pointer size (as if amigaos or compats would ever go 64bit. AROS could in theory, assuming all ptr arith uses IPTR and that taglists can cope 64bit values. AROS wisely introduced IPTR type, which always is able to represent pointer as ingeter, and this must be used in ptr arith instead of ULONG).

Anyway it's good style not to assume pointer size, at least if you write semi-portable code.