5.3.5/7 says:
If the value of the operand of the delete-expression is not a null pointer value, the delete-expression will call a deallocation function (3.7.4.2). Otherwise, it is unspecified whether the deallocation function will be called.
And 3.7.4.2/3 says:
The value of the first argument supplied to a deallocation function may be a null pointer value; if so, and if the deallocation function is one supplied in the standard library, the call has no effect.
So the behavior is well defined, as long as the standard deallocation function is used, or a user-provided deallocation function handles null pointers correctly.
Related Posts:
- Is null reference possible?
- Is “delete this” allowed in C++?
- Meaning of = delete after function declaration
- Using NULL in C++?
- basic_string::_M_construct null not valid after constructing subvector of strings
- C++ delete vector, objects, free memory
- Is std::stoi actually safe to use?
- Is std::stoi actually safe to use?
- Deleting a dynamically allocated 2D array
- C++ – Assigning null to a std::string
- Check if C++ Array is Null
- C++ Array of pointers: delete or delete []?
- set head to NULL (‘NULL’ : undeclared identifier)
- What is the easiest way to initialize a std::vector with hardcoded elements?
- Vector of Vectors to create matrix
- std::string to char*
- How to generate a random number in C++?
- Why are #ifndef and #define used in C++ header files?
- Conversion from string to char – c++
- How to find out if an item is present in a std::vector?
- Initializing an array of objects
- Passing an array by reference
- What does int argc, char *argv[] mean?
- Efficient way to return a std::vector in c++
- “No viable overloaded ‘=’ ” why?
- Replace part of a string with another string
- Error with multiple definitions of function
- What are C++ functors and their uses?
- invalid conversion from ‘const char*’ to ‘char*’
- Check if a string is palindrome
- What is an ‘undeclared identifier’ error and how do I fix it?
- Initializing a two dimensional std::vector
- SDL2.DLL missing
- Argument list for class template is missing
- Fastest way to check if a file exist using standard C++/C++11,14,17/C?
- Cleanest way to copy a constant size array in c++11
- Difference between using Makefile and CMake to compile the code
- Exception Error c0000005 in VC++
- push_back vs emplace_back
- Returning multiple values from a C++ function
- Eclipse C++ : “Program “g++” not found in PATH”
- no default constructor exists for class
- Press Enter to Continue
- How to trim a std::string?
- Parsing a comma-delimited std::string
- C++ BlackJack Stuck trying to program Ace
- Convert a String In C++ To Upper Case
- Visual Studio 2015 doesn’t have cl.exe
- Right way to split an std::string into a vector
- How to resize array in C++?
- C++: std does not have member “string”
- Fatal error: ‘stdafx.h’ file not found
- How do I add the MinGW bin directory to my system path?
- What are the distinctions between the various symbols (*,&, etc) combined with parameters?
- Accessors and Mutators C++
- Error C1083: Cannot open include file: ‘stdafx.h’
- How do you handle a “cannot instantiate abstract class” error in C++?
- How to cast the size_t to double or int C++
- How to get Current Directory?
- “used without template parameters”
- Reading from .txt file into two dimensional array in c++
- C++ Error ‘nullptr was not declared in this scope’ in Eclipse IDE
- C++ Simple hangman game
- “The system cannot find the file specified” when running C++ program
- Remove First and Last Character C++
- How to get current time in milliseconds?
- Resizing dynamic array in c++
- C++ – Nested include – Avoiding ‘include nested too deeply error’
- Why is inherited member not allowed?
- Error: macro names must be identifiers using #ifdef 0
- Error: free(): invalid next size (fast):
- Error: free(): invalid next size (fast):
- Fastest way to Convert String to Binary?
- Reading data from file into an array
- LINK : fatal error LNK1561: entry point must be defined ERROR IN VC++
- error LNK2019: unresolved external symbol “” referenced in function
- Undefined reference to a static member
- How to sort with a lambda?
- stoi function gives error: std::invalid_argument at memory location 0x0035E8D8. c++
- Stack around the variable ‘ ‘ was corrupted
- The difference between cin.ignore and cin.sync
- casting int to char using C++ style casting
- How to print (using cout) a number in binary form?
- What is the job of autogen.sh when building a c++ package on Linux
- Using G++ to compile multiple .cpp and .h files
- LPCSTR, LPCTSTR and LPTSTR
- How to do std::string indexof in C++ that returns index of matching string?
- Unrecognizable template declaration/definition
- MSVCP120d.dll missing
- Modulo operator with negative values [duplicate]
- Finding the type of an object in C++
- C++ Simple Dice roll – how to return multiple different random numbers [duplicate]
- How can I get a file’s size in C++?
- Why can’t I make a vector of references?
- What does “-Wall” in “g++ -Wall test.cpp -o test” do?
- C++ equivalent of StringBuffer/StringBuilder?
- Struct with template variables in C++
- error: no member function declared in class
- Why does my program give “NULL used in arithmetic”
- no matching function to call for “getline”