Hi List, Andreas Fink wrote: > > >[EMAIL PROTECTED] wrote: > > > >> As I see it this approach with octstr_compare is a part of the Kannel's > >> protective coding style where the NULL pointers are not meant to be used > >> as any other similar pointer. So the assert prevents the NULL pointer to > >> go on loosely and stops it before it may cause a segmentation fault on > >> some other part of the program that is not ready to handle NULL pointers. > >> Therefore the line between a NULL pointer and an empty octstr; first one > >> is an accident that shouldn't happen, the latter is a way to say that > >> there is no content. > > > >I agree in the view of protective coding style, hence we may > >distringuish between a NULL pointer and an empty content, IMO. > > Ok. how about dealing with NULL as a different string of "" but still > being able to compare NULL to something and NULL to NULL?
Kannel actually uses NULL for "no content at all" in case of optional configur- ation and cgi variables. I think that NULL case should be handled separately, before everything else, either with an assertion or a test. This is easier to code, too, because legal NULLs often appear during prototype testing. And, btw, I think that if NULL returned means anything else than a generic error, one must comment this. Aarno