On 14 October 2016 at 18:26, Nikolaus Dunn wrote: > Hi all, > > According to what I've read, the "new" and "new []" expressions are > implemented by the compiler to compute the size of the storage required by > the type and then make a call to one of the "new" operators to allocate > memory and handle construction. I've found the code for the "new" operators > in gcc, but I can't find where in the gcc code the compiler determines the > value to be passed to the new operator and then sets up the actual call. Look for build_new() in gcc/cp/init.c > The reason I'm asking is I am interested in how the compiler implements the > "new []" expression. In particular, how it is storing the array size and is > there any extra overhead being stored and what it is, if any. That is specified by the ABI, see https://mentorembedded.github.io/cxx-abi/abi.html#array-cookies > I'm assuming it is the actual parser/code generator that is doing this since > they are unique expressions and not simply function calls. Can someone point > me to where this code is being generated or correct my ignorance if I am way > off base?