Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Avoiding the == blues

by friedo (Prior)
on Dec 29, 2004 at 20:00 UTC ( [id://418067]=note: print w/replies, xml ) Need Help??


in reply to Re: Avoiding the == blues
in thread Avoiding the == blues

You are absolutely correct, of course, but this doesn't work for other languages, or for badly written scripts which generate thousands of warnings that you have to maintain. :)

Replies are listed 'Best First'.
Re^3: Avoiding the == blues
by gaal (Parson) on Dec 29, 2004 at 20:26 UTC
    In some other languages, if takes a boolean, which is (deliberately) not what an assignment returns, so if (x = 0) doesn't get past the compiler.
Re^3: Avoiding the == blues
by Anonymous Monk on Dec 30, 2004 at 10:07 UTC
    Well, saying "other languages" isn't quite correct, as it's the compiler that will issue a warning, if any. And gcc with -Wall will. It will even catch cases like:
    if (x = y)
    unlike Perls -w, which will let you do
    if ($x = $y)
    while keeping silent.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://418067]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-25 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found