[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: struct member initialization

From: Paul Pluzhnikov
Subject: Re: struct member initialization
Date: Wed, 03 Jan 2007 09:03:16 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) 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: warning: 'nString::<anonymous union>::strLen' will be 
initialized after warning:   'ushort nString::<anonymous union>::<anonymous 
struct>::localStrLen' warning:   when initialized here

Note that this is completely different from the warning in your
original test case (at the start of this thread).

To eliminate the warning, swap the order of initialization:

nString::nString() :

Since you shouldn't actually care about either 'strLen' or
'localStrLen' when string == 0, both of these initializations appear
to be unneccessary.

In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]