View previous topic :: View next topic |
Author |
Message |
neochrome32
Joined: 09 Jun 2013 Posts: 153
|
const in a consts |
Posted: Mon Jan 27, 2014 11:13 pm |
|
|
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.
just cant think of away around this!? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Tue Jan 28, 2014 2:55 am |
|
|
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
|
|
Posted: Tue Jan 28, 2014 11:49 am |
|
|
@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 |
|
|
|