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

const in a consts

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



Joined: 09 Jun 2013
Posts: 153

View user's profile Send private message Visit poster's website

const in a consts
PostPosted: Mon Jan 27, 2014 11:13 pm     Reply with quote

BIG issue, im trying to convert mikro code to ccs c

cant do it as mikro C will use const in a conts...

i need to turn this..

Code:



typedef struct Vocab {
   char *txt;
   char *phoneme;
} VOCAB;

static char const v270a[] =" J_";
static char const v270b[] =" JAY";




static const VOCAB s_vocab[] ={

   {const v270a}//,v270b}

};


into something CCS C will understand.

Smile

just cant think of away around this!?
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Tue Jan 28, 2014 2:55 am     Reply with quote

Syntactically, this is problematic in any language!.....

'static const', is insane as a construction (think about it...).

Now, your problem is not 'const in a const', but creating pointers to const.

Do a search hear about this, and the difference between 'rom', and 'const'.

Also you declare s_vocab as an array, but then only initialise one entry.

Remember also 'case' since you use VOCAB, and Vocab.
Code:

typedef struct Vocab {
   rom char *txt;
   rom char *phoneme;
} VOCAB;

rom char v270a[] =" J_";
rom char v270b[] =" JAY";
rom VOCAB s_vocab = {v270a,v270b};


Beware though only likely to work on a recent compiler.

Best Wishes
neochrome32



Joined: 09 Jun 2013
Posts: 153

View user's profile Send private message Visit poster's website

PostPosted: Tue Jan 28, 2014 11:49 am     Reply with quote

@Ttelmah your always helpful!! THANK YOU

i did get a massive result from #device const=rom

but i didn't know you could

rom const char *test;

hmm will play!! THANK YOU again!

have compile 4.130 though the newer one seems to be broken in many places

its ROM char *test --- this worked :D
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