|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
Does the compiler supports void pointers |
Posted: Sat Nov 20, 2004 8:08 pm |
|
|
my code is:
struct mystruct
{
void * var;
}
when I try to compile, I get an unknown type error in front of void.
What could be the problem and how can I solve this? |
|
|
Ttelmah Guest
|
Re: Does the compiler supports void pointers |
Posted: Sun Nov 21, 2004 4:59 am |
|
|
Anonymous wrote: | my code is:
struct mystruct
{
void * var;
}
when I try to compile, I get an unknown type error in front of void.
What could be the problem and how can I solve this? |
See the posts I have made about this in the past.
CCS, follows the _original_ K&R 'C' definition, with a 'void' being 'nothing'. With this, you cannot have a pointer to 'nothing', so what you post won't work. Latter, in ANSI C, the definition of a 'void' was changed, so it became in some circumstances 'nothing', but in other places an 'undefined type'. This latter definition, allowed you to have a 'void pointer', which then was automatically 'cast' to the required type when used.
Replace your pointer, with a pointer to any data type (generally an int8), and then manually cast it to the required type when used.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|