Namespaces
Variants
Views
Actions

Talk:cpp/language/delete

From cppreference.com

Hi!

I'm currently thinking whether the wording could be a bit improved here (though, I'm not a native speaker of the English language, maybe that's the reason, maybe it is clear enough to others but me).

1. It think it might be emphasized that - until C++14 - UB will result if new is matched with delete[] and vice versa. "Must be" is already a strong hint in this respect but let me suggest that UB should be explicitely mentioned, maybe in a separate paragraph: "Otherwise ..." or "If not properly matched (i.e. if new is used with delete[] or new[] with delete ... the consequence is UB."

2. That paragraph may also be extended that C++14 removed this requirement (AFAIK).

3. In the paragraph starting with "After that, unless the matching new-expression was combined with another (since C++14) the delete ..." I cannot quite make out to what "another" refers: "another (what?)"

But the latter may be caused by my deficiencies in practicing the English language frequently enough.

Mwe (talk) 07:21, 29 June 2015 (PDT)

Sure. "Otherwise, the behavior is undefined" is a good way to phrase a requirement (now added to the second paragraph. the first paragraph already said that). This did not change in C++14. As for "another", it refers to "new-expression". ("unless the matching new-expression was combined with another new-expression") --Cubbi (talk) 07:38, 29 June 2015 (PDT)

Thanks (for both, the change and the clarification that nothing changed wrt. UB in C++14). I'm not sure where I picked up the latter idea (no longer UB) and now I need to write one page less in my presentation "What's new in C++14/C++1y", which I currently prepare ... :-) Mwe (talk) 08:04, 29 June 2015 (PDT)