Il 02/09/20 14:23, dietmar.schind...@manrolandgoss.com ha scritto:
>> -----Original Message-----
>> From: busybox <busybox-boun...@busybox.net> On Behalf Of Tito
>> Sent: Monday, July 20, 2020 1:58 PM
>> To: busybox@busybox.net
>>
>> …
>> I for myself decided for being defensive and this until today
>> payed off for my little personal codebase.
> 
> How have you been able to determine that this "payed off"?

Hi,
because I know that I will make mistakes in the logic and I know
that I will have to fix the few programs that I wrote in  C +  GTK + Mysql
for my business for Linux and Windows 7/10 after years (despite comments in the 
source)
and I know it will be a terrible mess....(e.g just because a third party data 
supplier
decided to change something to beautify it...)
but I also know that my string functions will not crash on NULL strings,
my pointers are always initialized to NULL , are always reset to NULL after 
free,
my mysql functions check for errors and escape input and that they always are 
so kind to tell
me if something is wrong (in the GUI and/or terminal) without the need to 
recompile with DEBUG statements,
thusly in the end I save a lot of time by being defensive rather than
sitting in front of a crashed program and scratching my head.
Time is my scarcest resource and is valuable so in this sense it "payed off". 

Ciao,
Tito

>>>  Checking for NULL "just in case" is defensive programming, which is
>>> very bad. It means the programmer does not know exactly what the
>>> function contracts are: it would be better named "sloppy programming".
>>> Please don't do this.
>>>
>>> --
>>>  Laurent
> 
> --
> Regards,
> Dietmar Schindler
> ________________________________
> manroland Goss web systems GmbH | Managing Director: Franz Kriechbaum
> Registered Office: Augsburg | Trade Register: AG Augsburg | HRB-No.: 32609 | 
> VAT: DE815764857
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to