View unanswered posts | View active topics It is currently Sun Sep 20, 2020 11:48 pm

Reply to topic  [ 2 posts ] 
initialization of structures. 
Author Message

Joined: Wed Nov 14, 2012 4:22 am
Posts: 2
Post initialization of structures.
I came across a thread about this from then end of 2009 and again at the start of this year.. however they had compiler errors, and I don't so I assumed this feature had now been added, although admitedly nothing in the change logs.

If I try to statically initialize an array of structures I don't get any errors, but the structure elements are all zero.

typedef struct
int a;
int b;
int c;
} S;

S g_Array[3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

if I try to initialize a single element

S g_S = {1,2,3};

same thing

if I try to runtime initialize like this I get

**Error**:No code generation yet for dynamic initialization of 'struct' variables

so does that mean that at some future date, not to far away, static initialization of stucture arrays will happen?


Sun Dec 30, 2012 3:49 pm
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: initialization of structures.
Maybe, but I wouldn't hold my breath just yet :)

= Xander

| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]

Mon Dec 31, 2012 3:15 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

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 post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.