|
|
|
|
|
by pbsd
4271 days ago
|
|
That is a clarification [1] to the standard, to make it legal to avoid or fuse memory allocations if the compiler can prove it's OK. For example, int f() {
int * x = new int(0);
return *x;
}
does not really need to allocate memory, and so that `new` is now explicitly allowed not to. Similarly, int f() {
int * x = new int(0);
int * y = new int(1);
return *x + *y;
}
Here the standard allows not only to elide both allocations, but also to fuse them into a single (faster) allocation.[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n366... |
|