Why should we? It makes really no sense. And if you want to rely on 
"past experience" i.e what people do, instead of sense, take a look at libc:
free, strlen and strcpy are just a few of the many examples that don't 
accept NULL. Having sanity checks everywhere is not "safer", it just 
hides bugs at best, slows everything down, bloats the code and makes me 
want to hate myself.

Also, these tests in specific are not good enough. Such tests should be 
wrapped in macros that print a warning about the error case so users 
will avoid doing them in the future (if applicable), let you disable 
them, and are generally consistent.

Also, there's a very limited list of reasons why to do sanity checks:
1. If only we can do and the user can't.
2. If the checks are a lot easier for us to do than the user.
3. Very common checks that should be everywhere and we'll be saving a 
ton of code by doing them ourselves, and no, this doesn't apply here.

And generally, the checks should cover possible, but non idiotic cases 
that returning from gracefully actually makes sense.


--
Tom.


On 05/09/12 16:04, Daniel Juyung Seo wrote:
> we should check null at least for public apis.
>
> Daniel Juyung Seo (SeoZ)
> On Sep 5, 2012 5:23 PM, "Tom Hacohen" <tom.haco...@samsung.com> wrote:
>
>> I'm not sure we really want to add NULL checks everywhere. If the docs
>> say (or should say) passing NULL is not supported, we just shouldn't
>> pass NULL. We can't possibly do such sanity cases everywhere, as they'd
>> just slow us and the apps down, and bloat the code.
>>
>> --
>> Tom.
>>
>> On 05/09/12 11:19, Sungho Kwak wrote:
>>> Hi,
>>>
>>> I still have 10 more null chekcing patches :(
>>> This patch is for eet_lib.c. eet_identity_x509, eet_identity_signature,
>>> eet_identity_sha1 can be crushed
>>> when fucntion tries to if(!ef->sugnature) when ef is null.
>>>
>>> Thanks.
>>>
>>> Sincerely,
>>> Sungho Kwak.
>>>
>>>
>>>
>>>
>> ------------------------------------------------------------------------------
>>> Live Security Virtual Conference
>>> Exclusive live event will cover all the ways today's security and
>>> threat landscape has changed and how IT managers can respond. Discussions
>>> will include endpoint security, mobile security and the latest in malware
>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>
>>>
>>>
>>> _______________________________________________
>>> enlightenment-devel mailing list
>>> enlightenment-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> enlightenment-devel mailing list
>> enlightenment-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to