[Next] [Prev] [Up] [Top]

15.0 Memory

Prefer automatics to heap allocation. (R)


Use automatic variables instead of new/delete if the object's lifetime is a proper subset of the enclosing function or method.

Example:

void bad_function () {

X* xp = new X;

...

delete xp;

}

void good_function () {

X xi;

...

}


No Title
[Next] [Prev] [Up] [Top]

Generated with CERN WebMaker

This site was grabbed using the TRIAL version of Grab-a-Site. This message does not appear on a licensed copy of Grab-a-Site.