[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Xen-devel] [PATCH] Pointer should be checked before use



>Callers should not pass null pointers.  If they do it is better for
>the program to explode sooner than later; that makes tracking the
>fault much easier.
>
>So this kind of check, turning incoming null pointers into error
>returns, is a bad idea.
>

That may be better for debug tracking to let the caller process
segfault:). However, IMO as a function it's almost always a good
practice to check the parameters' validation before using it. Returning
an error if the caller passes invalid arguments is a more normal
behavior than directly letting the process be killed due to no argument
check. It may be too strict.

Regards,
Xiaowei

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.