digitalmars.D - Why does the rhs of delete have to be lvalue?
- Matthew (0/0) Mar 10 2005
- xs0 (1/1) Mar 11 2005 Just out of curiosity - when is it a problem?
- Matthew (4/5) Mar 11 2005 I'm formulating a treatise on why delete should be dropped for removing
- Ben Hinkle (3/3) Mar 11 2005 Doesn't it have to be a reference or pointer to something allocated usin...
- Ilya Minkov (10/10) Mar 11 2005 Matthew wrote:
- Walter (4/4) Mar 11 2005 So the reference can be nulled out. You won't have to write:
- Derek Parnell (10/16) Mar 11 2005 So would it be possible to change the D behaviour such that if the coder
- Matthew (4/8) Mar 11 2005 Gotcha. (That just adds grist to my mill, however, ....)
-
David L. Davis
(9/9)
Mar 12 2005
In article
, Matthew says...
I'm formulating a treatise on why delete should be dropped for removing elements from AAs, and this is making it easier than I'd expected. ;) "xs0" <xs0 xs0.com> wrote in message news:d0rrqh$1kk8$1 digitaldaemon.com...Just out of curiosity - when is it a problem?
Mar 11 2005
Doesn't it have to be a reference or pointer to something allocated using 'new' (aside from the AA usage)? I'm not exactly sure what is 'delete'able and what isn't.
Mar 11 2005
Matthew wrote: [nothing but the topic] I believe because the value is being written to. E.g. when it is a pointer it gets nulled out. [though that's probably not what Matthew wants to hear from me. i apparently don't get the vague hint but seeing this Matthew might want to explain something to dumbasses such as myself] [I should have probably considered posting the whole message in the subject line though] -eye
Mar 11 2005
So the reference can be nulled out. You won't have to write: delete p; p = null; which is a common C++ idiom.
Mar 11 2005
On Fri, 11 Mar 2005 13:23:04 -0800, Walter wrote:So the reference can be nulled out. You won't have to write: delete p; p = null; which is a common C++ idiom.So would it be possible to change the D behaviour such that if the coder used a lvalue, D would null it out, otherwise if the coder did not use an lvalue then D would not attempt to null it out. Also, this is the sort of thing that needs to be explicitly documented in the official docs. -- Derek Parnell Melbourne, Australia 12/03/2005 8:55:04 AM
Mar 11 2005
"Walter" <newshound digitalmars.com> wrote in message news:d0t3hr$h0a$1 digitaldaemon.com...So the reference can be nulled out. You won't have to write: delete p; p = null; which is a common C++ idiom.Gotcha. (That just adds grist to my mill, however, ....) :-)
Mar 11 2005
In article <d0qrve$gm9$1 digitaldaemon.com>, Matthew says...Matthew this may seem like a pretty dumb question, but what does RHS stand for? I'm thinking that it stands for "Right Hand Side." Thanks in advance. David L. P.S. When I was in the U.S. Army we had a saying, that "The only dumb question, is the one that wasn't asked." ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
Mar 12 2005