"Richard L. Hamilton" <[EMAIL PROTECTED]> wrote:
> > Strictly conformant to the above would therefore be:
> >
> > #define dirfd(dp) ((dp) ? (dp)->dd_fd : -1)
> >
> > You'd still crash if you pass an invalid pointer,
> > though.
>
> Regardless of one's opinion on checks for NULL args, as a macro,
> that's bad, with multiple references to the arg on the right hand side
> (think side-effects if someone has an array of DIR * and passes
> *dpp++). And if the standard allows a macro as well as a function,
> and of course both should behave the same, I suppose that implies
> at the very least that anyone wanting the performance of a macro
> in addition to a function couldn't possibly be interested in optional
> argument validation.
There is no performance problem if you use a function.
As mentioned several times, passing an invalid object to dirfd()
may cause a coredump.
Jörg
--
EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin
[EMAIL PROTECTED] (uni)
[EMAIL PROTECTED] (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
opensolaris-discuss mailing list
[email protected]