note 71942 added to function.assert
| From: | tomrussoatgmaildotcom at osu1 dot php dot net | Date: | Sun, 24 Dec 2006 23:25:15 +0000 |
| Subject: | note 71942 added to function.assert | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120892@lists.php.net to get a copy of this message | ||
hodgman at ali dot com dot au said:
"Assertions should only be enabled during testing/development, and then disabled once your code
reaches a production stage."
Assertions should _not_ be turned off in production code. Although it's common to do so,
turning off assertions in production is a bad practice.
If your production code fails an assert, YOU WANT TO KNOW ABOUT IT. Asserts are a debugging tool,
but you should not stop debugging your code just because it has gone into production.
Many people claim that removing asserts gives a performance benefit. In modern programming
languages this simply isn't true. If you were doing an assert on something that is extremely
slow/expensive to compute, you might consider turning that assert off. But in practice this really
isn't how asserts are used.
There's a good discussion of this issue in the book The Pragmatic Programmer.
----
Server IP: 64.71.164.2
Probable Submitter: 24.128.231.254
----
Manual Page -- http://www.php.net/manual/en/function.assert.php
Edit -- https://master.php.net/note/edit/71942
Del: integrated -- https://master.php.net/note/delete/71942/integrated
Del: useless -- https://master.php.net/note/delete/71942/useless
Del: bad code -- https://master.php.net/note/delete/71942/bad+code
Del: spam -- https://master.php.net/note/delete/71942/spam
Del: non-english -- https://master.php.net/note/delete/71942/non-english
Del: in docs -- https://master.php.net/note/delete/71942/in+docs
Del: other reasons-- https://master.php.net/note/delete/71942
Reject -- https://master.php.net/note/reject/71942
Search -- https://master.php.net/manage/user-notes.php