Namespaces
Variants
Views
Actions

Difference between revisions of "Talk:cpp/memory/new/operator new"

From cppreference.com
(Questioning the naming covention changing along the way.)
 
(Adding some formatting.)
Line 4: Line 4:
 
The class specific definition of the new operator says "count" as a parameter:
 
The class specific definition of the new operator says "count" as a parameter:
  
 +
{{example
 +
|code=
 
void* T::operator new  ( std::size_t count );
 
void* T::operator new  ( std::size_t count );
 +
}}
  
 
However, the X structure example changes the name of the parameter to "sz" and uses it in "new(sz)".
 
However, the X structure example changes the name of the parameter to "sz" and uses it in "new(sz)".
  
 +
{{example
 +
|code=
 
static void* operator new(std::size_t sz)
 
static void* operator new(std::size_t sz)
 +
}}
  
 
Alexis Wilke 20:46, 26 October 2021 (PDT)
 
Alexis Wilke 20:46, 26 October 2021 (PDT)

Revision as of 19:48, 26 October 2021

Naming Convention

The class specific definition of the new operator says "count" as a parameter:

void* T::operator new  ( std::size_t count );

However, the X structure example changes the name of the parameter to "sz" and uses it in "new(sz)".

static void* operator new(std::size_t sz)

Alexis Wilke 20:46, 26 October 2021 (PDT)