Quote:when you say new(1024), you are using C++ keyword new, which represents the new operator. The job of new operator is : 1. to allocate the memory 2. to call the constructor. The (1)st job is done using C++'s inbuilt 'operator new'. (Bad overloading of terminologies!). The prototype of "operator new" is void* operator new (size_t); Thus, In the first example, the new operator expects the 'type' and not the size, since it also needs to call the constructor on that type. Hence the first line gives compilation error. (1024 is not a type.) On the second line, you are explicitly calling the 'operator new'. In other words, what you are doing is only the first step (allocating the memory). The 'operator new' requires size_t which you have provided properly (1024), and hence the code compiles properly.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)