Do i require checking for null before delete p?, C/C++ Programming

No. it's not required

The C++ language guarantees that delete p will do nothing if p is equivalent to NULL. As you might get the test backwards, and as most testing methodologies force you for performs test explicitly every branch point, you should not put in the redundant if test.

Wrong:                    

if (p != NULL)

delete p; Right: delete p;

 

Posted Date: 3/19/2013 8:40:07 AM | Location : United States







Related Discussions:- Do i require checking for null before delete p?, Assignment Help, Ask Question on Do i require checking for null before delete p?, Get Answer, Expert's Help, Do i require checking for null before delete p? Discussions

Write discussion on Do i require checking for null before delete p?
Your posts are moderated
Related Questions
New App Production company is seeking an organized and highly accomplished design team to prepare the first (and potentially more) of my companies' App concepts, intended completel

What are the various types of control structures in programming? - Primarily there are 3 types of control structures in programming: Sequence, Selection and Repetition. - Se

ambiguity in multiple inheritance

Public, Private and Protected members: Class members can either be declared in public','protected' or in the 'private' sections of the class. But as one of the features of OOP i

if one won't explicitly call the destructor of a local; then how does he handle the above situation?

Define Enumeration in Computer Programming? Enumerated types enclose a list of constants that are able to be addressed in integer values. We can declare variables and types

#questionAt a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets

The Malt Shop restaurant charges $2.99 for burgers, $1.29 for fries, and $1.25 for sodas.  Write a program that allows a restaurant employee to enter an order (the number of bur


Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b