> Richard L. Hamilton wrote:
> > Shouldn't this use MAP_ANON and an fd arg of -1
> rather than explicitly
> > opening /dev/zero?  One less thing to go wrong,
> > two less statements and syscalls, typically.
> > 
> > Also, why ask for just one byte, since you
> presumably get a whole page anyway?
> > Why not explicitly ask for enough to hold the
> largest fundamental type?  If people are going to do
> something stupid like this, they
> > might well be dereferencing _any_ sort of pointer,
> not just char *.  Obviously
> > that could be a pointer to a struct or whatever
> too, but that's an open-ended
> > situation, wherein trying to anticipate the scope
> of the foolishness leads to
> > madness.  Granted though that passing a NULL to
> something expecting a
> > string is perhaps the most common, and [EMAIL PROTECTED] at least
> allows one to work
> > around that.  
> 
> I could but then it would mask even more problems
> than [EMAIL PROTECTED] does today 
> and that might not be a good thing.  At the end of
> the day attempting to 
> dereference NULL is a bug in the source and it really
> should dump core 
> so it can be fixed.
> 
> I've considered creating an alternative to using [EMAIL PROTECTED]
> since I find that 
> most of the time I need it is for compatibility with
> glibc behaviour of 
> the printf family, so having an LD_PRELOAD that just
> copied their 
> behaviour would be helpful.  Or may it could be done
> like the 
> xpg-values.o stuff.
> 

That would be more specific certainly.

>From time to time, I've found myself (for debugging) using a macro like

#ifdef DEBUG
#define safestr(s) ( ((s)==NULL)?"(null)":(s) )
#else
#define safestr(s) s
#endif
although that references s twice, which isn't side-effect-safe (could be
made safe as a function easily enough).
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to