Re: mach_port_t
Re: mach_port_t
- Subject: Re: mach_port_t
- From: email@hidden (Peter Seebach)
- Date: Mon, 01 Aug 2005 13:38:17 -0500
In message <email@hidden>, Garth Cummings wri
tes:
>The main thing that changed is that the C standard now defines NULL
>as (void *) 0. Earlier versions of the language did not specify a
>value for NULL and most implementations defined NULL as 0.
The C standard has defined NULL the same way since 1989; it is either
an integer constant expression equal to zero, or the same cast to (void *).
(Formally, "an implementation-defined null pointer constant.")
What I don't understand is why something that has always been essentially
a pointer thing (even if it wasn't always implemented that way) has been
used for things that aren't pointers.
>Converting a pointer to an integer is legal but non-portable: the
>result is implementation-defined.
Yes.
>You'd have to ask the authors of the code. :-) My guess is that NULL
>was just convenient. More strictly correct would be MACH_PORT_NULL.
>Tiger also introduced IO_OBJECT_NULL as ((io_object_t) 0).
>Tiger was built (mostly) with gcc 3.3. As Mac OS X moves to being
>built with gcc 4.0, I would expect these warnings to be cleaned up.
Okay, that makes sense.
>In the I/O Kit master port case, since Jaguar there's been the
>constant kIOMasterPortDefault. Just pass that to any call that needs
>the I/O Kit master port, and you no longer need to call IOMasterPort
>() explicitly.
I was just using the example code for the HID driver stuff.
Anyway, MACH_PORT_NULL and IO_OBJECT_NULL seem like good matches.
-s
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden