2010/10/15 Daniel-Constantin Mierla <mico...@gmail.com>:
> Even we like it or not, non-type-safety languages such as perl, shell or
> python rule the sys admin world.

Said that I would like to expose a proposal for comparisons:


1) Never do implicit type conversion. This is, a string is NEVER equal
to an integer:

    if "0" == 0     =>  false
    if "" == 0       => false
    if "asdasd" == 0     => false


2) An integer is NEVER equal to a string:

    if 0 == "0"     =>  false
    if 0 == ""       => false
    if 0 == "asdasd"     => false


3) Integer 0 is not equal to NULL:

     if 0 == NULL   => false


4) Empty string is not equal to NULL:

     if "" == NULL  => false


5) Integer 0 is true:

     if 0   => true


6) Empty string is true:

     if ""  => true



The only point I'm not sure is the last one (6). In some high level
languages (as Ruby) checking an empty string returns true. However in
other languages (as ActionScript) it returns false.


-- 
Iñaki Baz Castillo
<i...@aliax.net>

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to