Page 1 of 1

are you using assert() and what for?

Posted: Sun Jul 30, 2006 1:41 am
by jmut
I am talking about

Code: Select all

assert()
Are you using it during development...do you find it useful.

Posted: Sun Jul 30, 2006 1:49 am
by Charles256
I personally don't use it..but a snippet from the manual...
Assertions should be used as a debugging feature only. You may use them for sanity-checks that test for conditions that should always be TRUE and that indicate some programming errors if not or to check for the presence of certain features like extension functions or certain system limits and features.

Assertions should not be used for normal runtime operations like input parameter checks. As a rule of thumb your code should always be able to work correctly if assertion checking is not activated.

Posted: Sun Jul 30, 2006 7:34 am
by feyd
I don't use them much in PHP.

Posted: Sun Jul 30, 2006 10:00 am
by Ambush Commander
I've heard of them for something called "Contract-based programming" but I've never actually used them.

Posted: Sun Jul 30, 2006 2:48 pm
by jmut
cool. me neither :)
actually once...but didn't see much benefit.

Posted: Sun Jul 30, 2006 3:12 pm
by RobertGonzalez
I never knew that function existed?!?!? ( :?: :!: :?: :!: :?: :!: )