Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

How to initialize a a struct of structs inside a header file in C? -


i trying port old code on 20 year old dos system gnu linux system. in several of header files, (which included on place), have structs of structs declare , initialize. getting warnings when compile way legacy code written. tips on how can work staying inside same header file?

the following simplified example made of doing.

struct {      struct b  temp1;     struct c  temp2; };  struct b {      int temp3;     int temp4;      int temp5; };  struct c {      int temp6;     int temp7;     int temp8; };   //these variables in how related initialization below  //struct test_one = {{temp3,temp4,temp5},{temp6,temp7,temp8}};  struct test_one = {{1,2,3},{4,5,6}}; 

you shouldn't instantiate structures in header files. if different instance created in each c file include header in not desired effect.

in c file have following.

void foo(){ struct parent; struct b child_b; struct c child_c;  child_b.temp3 = 3; child_b.temp4 = 4; child_b.temp5 = 5;  child_c.temp6 = 6; child_c.temp7 = 7; child_c.temp8 = 8;  parent.temp1 = child_b; parent.temp2 = child_c; } 

i strong consider making helper functions similar this

void initb(struct b* s, int x, int y, int z){     s->temp3 = x;     s->temp4 = y;     s->temp5 = z; } 

if keep array initialization syntax consider using union.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -