CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Does the compiler supports void pointers

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








Does the compiler supports void pointers
PostPosted: Sat Nov 20, 2004 8:08 pm     Reply with quote

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
PostPosted: Sun Nov 21, 2004 4:59 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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