From: SourceForge.net <no...@so...> - 2004-10-27 03:47:41
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=2824058 By: neo_in_matrix I am using mingw 3.4.2 (lastest as of writing) and I came across a rather interesting warning. The following code void* p; p = new char[100]; delete p; produces this warning: 13 C:\Dev-C++\Projects\test.cpp [Warning] deleting `void*' is undefined That does not make sense. See below for a part of the draft Standard: 5.3.5 Delete [expr.delete] 1 The delete-expression operator destroys a most derived object (_intro.object_) or array created by a new-expression. delete-expression: ::opt delete cast-expression ::opt delete [ ] cast-expression The first alternative is for non-array objects, and the second is for arrays. The operand shall have a pointer type, or a class type having a single conversion function (_class.conv.fct_) to a pointer type. The result has type void. Note that last sentence? The result has type *void*. That's exactly how delete works. It expectes a void pointer! So in any way, this warning is a *stupid* one and should be removed. ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=286529 |