Abraxas/Meyers: Effective C++  Home  Table of Contents

Module - m16.html

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++ Test-Suite

Meyers: Effective C++ Test Suite for Module - m16.cpp

// Item 16: Use the same form in corresponding uses of new and delete. 73

void m16()



Function Name: m16()

{
  int *nArray = new int[20];
  int *nArray1 = new int[20];
  int *pInt = new int;
  int *pInt1 = new int;
  delete[] nArray; // good
  delete pInt; // good
  delete nArray1; // bad
  delete[] pInt; // bad
}



Function Name: foo()

void foo() {
const int x = 63;

//new (int(*p)) int; // new-placement expression

p)) int; // new-placement expression
new (int(*[x])); // new type-id
delete x;
}

Abraxas/Meyers: Effective C++  Home  Table of Contents

ABRAXAS SOFTWARE - CodeCheck Meyers: Effective C++ Test-Suite