Skip to main content
gamedev.net
🔒 Locked

Casting from void*

Started by fisheyel83l 6 replies 350+ views
Original Post
fisheyel83l
fisheyel83l
One of my functions accepts a void* parameter. I want to cast the argument to a structure pointer, but i get the warning that the pointers are incompatible. Is there any way to do this?
Tolerance is a drug. Sycophancy is a disease.
daerid
daerid
How are you casting it?
daerid@gmail.com
fisheyel83l
fisheyel83l
prototype: function( void* one );
cast: one = (str*)one;
Tolerance is a drug. Sycophancy is a disease.
Sneftel
Sneftel
"one = (str*) one;"

That assigns the str* back to the variable "one", giving you a warning because it has to convert back from str* to void*. It does nothing.

how ''bout this:
"str* other = (str*) one;"


How appropriate. You fight like a cow.
fisheyel83l
fisheyel83l
Thanks guys. It''s working now.
Tolerance is a drug. Sycophancy is a disease.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.