site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com In message <B99D18B1-98D9-48B8-96A5-C2B2EC121C37@apple.com>, 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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
seebs@plethora.net