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 support@ccsinfo.com

Struct assignment?

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



Joined: 09 Mar 2010
Posts: 314
Location: Denmark

View user's profile Send private message

Struct assignment?
PostPosted: Sun Dec 12, 2010 8:30 am     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sun Dec 12, 2010 8:36 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Dec 12, 2010 9:03 am     Reply with quote

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"
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