Update reference-types.rst

This commit is contained in:
aathan 2022-03-24 10:25:01 -07:00 committed by Leo Alt
parent 681581d7f0
commit 18ce69ebbd

View File

@ -85,8 +85,10 @@ Data locations are not only relevant for persistency of data, but also for the s
// The following does not work; it would need to create a new temporary /
// unnamed array in storage, but storage is "statically" allocated:
// y = memoryArray;
// This does not work either, since it would "reset" the pointer, but there
// is no sensible location it could point to.
// On the other hand: "delete y" is not valid, as assignments to local variables
// referencing storage objects can only be made from existing storage objects.
// It would "reset" the pointer, but there is no sensible location it could point to.
// See "delete" under Operators
// delete y;
g(x); // calls g, handing over a reference to x
h(x); // calls h and creates an independent, temporary copy in memory