xmame  

Re: Insignificant unofficial b10 bug

Lawrence Gold
Tue, 12 Dec 2000 07:35:00 -0800

But the line in question is doing

        int x = NULL;

which seems rather strange.  I haven't looked at the code following it,
though, so there may be a good reason for setting an integer to NULL.

Bit of trivia for C++ programmers: With a standards-compliant compiler,
there's no reason to set a pointer to NULL.  Setting it to 0 will do the
right thing (i.e., the pointer will be set to whatever represents an
invalid pointer on the target machine).

On Tue, Dec 12, 2000 at 08:05:16AM +1300, Simon Hosie wrote:
> It's not an oversight at all.  A zero-valued pointer is not an integer, and
> cannot be implicitly cast to an integer.  In the situations where NULL can
> be assigned to an integer it has usually been defined as 0. That can cause
> trouble in untypechecked situations.  In DOS compilers, for example, where a
> pointer may be 32 bits and an integer 16 (the memory models with more than
> 64k dataspace), and you're assembling a variable length argument list.
> If you want an integer 0 then use the appropriate symbol.
> ---------------------------------------------------------------------------
> Send administrative requests to [EMAIL PROTECTED]
---------------------------------------------------------------------------
Send administrative requests to [EMAIL PROTECTED]