Re: struct member initialization

2007-01-03 Thread Grizlyk
Paul Pluzhnikov wrote: > Your sample is still non-compilable (you should strive to post > complete compilable test cases), but easily fixed with 2 typedefs. It is possible, he has used "-fms-extensions" flag. from gxx-4.1.0 info: "-fms-extensions" MFC compatible. Keywords "struct" and "union" a

Re: struct member initialization

2007-01-03 Thread Paul Pluzhnikov
[EMAIL PROTECTED] writes: > Sorry if my example code was incomplete. Your sample is still non-compilable (you should strive to post complete compilable test cases), but easily fixed with 2 typedefs. The sample also compiles fine (gcc-3.4.6, 4.1.1) but with '-Wall' gives a warning: union.cc:21

Re: struct member initialization

2007-01-03 Thread fernspaanakker
Hi, Sorry if my example code was incomplete. The code is actually from a string class which was written in MSVC++. The string class has an optimization to store small strings locally in the class without using dynamic memory allocation for "string". If "this->string" has a valid pointer, the union

Re: struct member initialization

2007-01-03 Thread Paul Pluzhnikov
[EMAIL PROTECTED] writes: > I also have a followup: What if the struct is anonymous? Can you still > initialize then? Post a complete example showing what you are trying to do. > Example (made it more complicated by making it part of an anonymous > union): This creates an anonymous union which

Re: struct member initialization

2007-01-02 Thread fernspaanakker
I also have a followup: What if the struct is anonymous? Can you still initialize then? Example (made it more complicated by making it part of an anonymous union): union { uint strLen; struct { char localString[LOCALSTRINGSIZE]; ushort local

Re: struct member initialization

2007-01-02 Thread fernspaanakker
Thanks, that works like a charm. ___ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus

Re: struct member initialization

2007-01-02 Thread Paul Pluzhnikov
[EMAIL PROTECTED] writes: > To correct this I want to perform member > initialization, but I have no idea how to do this correctly. Add initializing constructor to MyDate: > typedef struct MyDate > { > unsigned short year; > unsigned short month; > unsigned short day; MyDate() : year(0

struct member initialization

2007-01-02 Thread ferns-paanakker
Hi g++ experts, First of all, happy new year and the best wishes for 2007! I get a warning in g++ when I use a struct which I don't initialize in the member initialization, but in the constructor itself. To correct this I want to perform member initialization, but I have no idea how to do this cor