ID:95320
 
Resolved
switch() formerly was treating null and 0 as the same thing, but will properly treat them as different values in games compiled from this version on. Games compiled in older versions will not change their behavior.
BYOND Version:467
Operating System:Windows 7 Pro
Web Browser:Firefox 3.6.3
Applies to:Dream Daemon
Status: Resolved (468)

This issue has been resolved.
Descriptive Problem Summary:
Zero and null are the same in the switch.
If this is intentional I would like it to be documented.
Code Snippet (if applicable) to Reproduce Problem:
mob/verb/Bug()
switch(0)
if(null)
world<<"Fails"
if(0)
world<<"Works"
switch(null)
if(0)
world<<"Fails"
if(null)
world<<"Works"


Expected Results:
It to know the difference between null and zero
Actual Results:
It triggers the first case in the switch
Does the problem occur:
Every time? Or how often?
Every time

Workarounds:
Convert it to a string first.
From what I understand, 0, null, and "" equate to the same thing for stuff like that, such that:
var cake=0;pie="", apple=null
if(!cake && !pie && !apple)
world << 1
//would execute..
Documentation says: 'The "switch" instruction is a compact notation for a lengthy "else-if"'
Meaning this
mob/verb/Bug()
switch(0)
if(null)
world<<"Fails"
if(0)
world<<"Works"

Should be the same as this
mob/verb/Bug()
if(0==null)
world<<"Fails"
else if(0==0)
world<<"Works"

But its not... As you can see the first one fails and the second one passes even though the two functions should be equivalent according to the documentation.

Although your right in the sense that the not instruction is doing more then the documentation is saying. '1 if A is zero; 0 otherwise.'