Re:What =delete means
by edflsafoiewq on Monday October 18, 2021 @10:51AM
(#28906017)
A semantic pitfall would be something where you think the code means one thing (a patch of grass) but it really means another (you fall into the spikes). =delete is neither; it is not possible to confuse it for operator delete, and I don't see even a hole to get your foot stuck in, let alone any spikes.
[ Parent
| on HN ]
Re:What =delete means
by tialaramex on Monday October 18, 2021 @11:46AM
(#28906716)
Fair. I wouldn't have chosen the phrase "semantic pitfall", however after some thought I think it would classify as a "hole to get your foot stuck in" because it's unexpected in an artificial language to have this. If you're a learner and you covered "delete" the operator last week, then missed a day, and now there's = delete on the slides, do you raise your hand to ask what's this completely new syntax? No, right, it must somehow be the delete operator you learned about, as otherwise it would have a different name... wouldn't it?
But sure, C++ does have actual hidden spike traps, where unwary programmers are going to hurt themselves badly by mistake and this is not one of those.
Re:What =delete means
by squeaky-clean on Monday October 18, 2021 @01:26PM
(#28908052)
> it is not possible to confuse it for operator delete,
I haven't written C++ in many years and my interpretation of the code examples before reading the rest of the article was that it was somehow binding it to the delete operator as a function.