View previous topic :: View next topic |
Author |
Message |
hmmpic
Joined: 09 Mar 2010 Posts: 314 Location: Denmark
|
Struct assignment? |
Posted: Sun Dec 12, 2010 8:30 am |
|
|
Why is it not legal in CCS to assign a const struct with values from the struct itself?
All the assign and calculation is done at compile time.
The problem is this statement:
EEPos.Data+sizeof(EEData),//EE phone1
Code: | char PhoneN[20];
struct{
int8 Value0;
int8 Value1;
int8 Value2;
char Pass[11];
}EEData; |
Code: | //Position in EEprom
struct{
int8 Data;
int8 ph1;
int8 ph2;
int8 ph3;
}const EEPos={
10, //Assign 10 byte to? and then EE Data position
EEPos.Data+sizeof(EEData),//EE phone1
EEPos.ph1+ sizeof(phoneN),//EE phone2
EEPos.ph2+ sizeof(phoneN) //EE phone3
}; |
Last edited by hmmpic on Sun Dec 12, 2010 9:06 am; edited 2 times in total |
|
|
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
|
Posted: Sun Dec 12, 2010 8:36 am |
|
|
This was just discussed a few days ago: http://www.ccsinfo.com/forum/viewtopic.php?t=44203. As to why, ask CCS support I guess. In my opinion you should be able to do that, but if you can't - you can't. You can ask CCS to include that in a future release as a fix, though. |
|
|
hmmpic
Joined: 09 Mar 2010 Posts: 314 Location: Denmark
|
|
Posted: Sun Dec 12, 2010 9:03 am |
|
|
hmm it's not the same q. If I just use a number it work. I use a number for now. It was more clear if I use EEPos.Data+sizeof(EEData), but CCS dont like this:"EEPos.Data" |
|
|
|