Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
March 11, 2005 Why does the rhs of delete have to be lvalue? | ||||
---|---|---|---|---|
| ||||
March 11, 2005 Re: Why does the rhs of delete have to be lvalue? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Just out of curiosity - when is it a problem? |
March 11, 2005 Re: Why does the rhs of delete have to be lvalue? | ||||
---|---|---|---|---|
| ||||
Posted in reply to xs0 | 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? |
March 11, 2005 Re: Why does the rhs of delete have to be lvalue? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | 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. |
March 11, 2005 Re: Why does the rhs of delete have to be lvalue? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | 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 |
March 11, 2005 Re: Why does the rhs of delete have to be lvalue? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | So the reference can be nulled out. You won't have to write: delete p; p = null; which is a common C++ idiom. |
March 11, 2005 Re: Why does the rhs of delete have to be lvalue? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | 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 |
March 11, 2005 Re: Why does the rhs of delete have to be lvalue? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "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, ....) :-) |
March 12, 2005 Re: Why does the rhs of delete have to be lvalue? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | 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!" |
Copyright © 1999-2021 by the D Language Foundation