Re: Turning off 'deleting 'VOID*' is undefined' error
Re: Turning off 'deleting 'VOID*' is undefined' error
- Subject: Re: Turning off 'deleting 'VOID*' is undefined' error
- From: "Clark Cox" <email@hidden>
- Date: Mon, 29 Jan 2007 08:55:48 -0500
Then, please do not ignore the warning (which should be an error
IMHO). Using the delete operator on a void pointer is undefined
behavior (you have no guarantee that it will work on windows either).
For the delete to be defined, the type used must either:
1) Be a pointer the same type as was passed to new, or...
2) Be a pointer to a a type that has a virtual destructor and is a
superclass of the original type passed to new.
On 1/29/07, Mike <email@hidden> wrote:
Porting a bunch of Windows C++ (which I didn't write) to Xcode.
Apparently a void* is being used as a field of a struct which holds a ptr
to an object and the actual object type (class) can vary.
Mike
Chris Espinosa wrote:
On Jan 28, 2007, at 7:25 PM, Mike wrote:
Is there a setting in Xcode 2.4.1 for turning off the
warning: deleting 'VOID*' is undefined
warning?
No, there isn't. The C++ standard says you can only delete() things
allocated with new(), as delete() must call free() first. So the compiler
cannot generate correct code for delete of a 'void *'. The warning is there
to warn you that your code may be doing any number of unintended things.
What are you really trying to do?
Chris ________________________________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Clark S. Cox III
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden