RE: [PHP4BETA] Warnings for C-isms that might be errors
| From: | Dan | Date: | Tue, 11 Jan 2000 22:47:36 +0000 |
| Subject: | RE: [PHP4BETA] Warnings for C-isms that might be errors | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-9057@lists.php.net to get a copy of this message | ||
I would prefer to have a "const" declaration.
I have been using 'if (TRUE == $flag)' to trigger an error if I omit an '='
and heartily recommend it to all.
Dan Sevush
CTO Dan's Chocolates
www.danschocolates.com
-----Original Message-----
From: garyb@fxt.com [mailto:garyb@fxt.com]
Sent: Tuesday, January 11, 2000 5:17 PM
To: php4beta@lists.php.net
Subject: [PHP4BETA] Warnings for C-isms that might be errors
Now that I've spent a couple of hours debugging these problems, I'd like
to propose a new warning level, for code that is syntactically correct but
might be not what was intended. This might useful when viewing source with
phps.
Certain very useful C features that have been added to PHP are also well
known bug generators. My best example this minute is use of assignments
inside conditionals. Often we mean too, but sometimes we want to see if
that's what we really meant.
if ($a=$b)
Inadvertant use of assignment when we con't mean to. My personal fave,
always returns true after it makes it so. Many happy hours figuring out
what's not working.
In order to see these, I sometimes use 'grep "(.*=.*)" myfile', also
'grep "[{}]" myfile' to view code structure.
Other items are in the "fumblefingers" category:
if (!!$foo)
Not-not what we intended?
-- PHP 4.0 Beta Mailing List To unsubscribe, e-mail:
php4beta-unsubscribe@lists.php.net For additional commands, e-mail:
php4beta-help@lists.php.net To contact the list administrators, e-mail:
php4beta-admin@lists.php.net