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

Void() in a structure

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



Joined: 11 Sep 2003
Posts: 2

View user's profile Send private message

Void() in a structure
PostPosted: Fri Sep 10, 2004 8:48 am     Reply with quote

Why I can't use this piece of code?
Code:

typedef const struct _rom_desc_tsk
{
   unsigned char prioinit;
   unsigned int stackAddr;
   void   *nParameters;         //  Unknown type!
   unsigned char futur_use;
   unsigned char id_tch;
   unsigned int  ctx_tch;
} rom_desc_tsk;


The compiler don't let me use a void pointer inside the structure! The error that show me is: "unknown type"

thnx in advance

davng
Ttelmah
Guest







Re: Void() in a structure
PostPosted: Fri Sep 10, 2004 10:21 am     Reply with quote

Davng wrote:
Why I can't use this piece of code?
Code:

typedef const struct _rom_desc_tsk
{
   unsigned char prioinit;
   unsigned int stackAddr;
   void   *nParameters;         //  Unknown type!
   unsigned char futur_use;
   unsigned char id_tch;
   unsigned int  ctx_tch;
} rom_desc_tsk;


The compiler don't let me use a void pointer inside the structure! The error that show me is: "unknown type"

thnx in advance

davng

I'm not suprised.
'void' has two different meanings. The first is effectively a 'null' defintion for data types (as in a function that returns nothing). The second form, _was an extension to C, that is part of the ANSI definitions_, where it replaces 'char *', as the generic data pointer. CCS C, _is not ANSI C_. It retains the original K&R defintions, where char * is the generic pointer.
Some 'ANSI like' forms are allowed in places, but most are dubious, and should be used with care...
Basically you are trying to use an ANSI C structure, in a C that does not relibly support this.
Change it to char *, and cast it to the type that is actually required, when accessed.

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