new should lower to a template function call
Adam D. Ruppe
destructionator at gmail.com
Thu Jul 23 01:05:47 UTC 2020
Two thoughts on the subject:
1) it should probably always be inlined so it doesn't make new
symbols in codegen.
2) the compiler should be free to cheat a little for
optimization; if it can see the var never escapes, it might even
still pop it on the stack (perhaps the function receives a
pointer to the memory and if null, it is responsible for allocing
it). This may not be implemented but the spec should at least be
written to allow it later. This kind of optimization can be a
real winner with scope too.
More information about the Digitalmars-d
mailing list