Warning this will be initialized after that



 DEVELOP > c-Plus-Plus > Warning this will be initialized after that

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "Christopher"
Date: 05 Feb 2008 07:51:09 PM
Object: Warning this will be initialized after that
What causes this kind of warning to occur? why is the compiler forcing
some order of initialization in an initializer list?
I frequently run into this when I am initializing a pointer and an int
in a constructor's initializer list.
.

User: "Alf P. Steinbach"

Title: Re: Warning this will be initialized after that 05 Feb 2008 07:59:28 PM
* Christopher:

What causes this kind of warning to occur? why is the compiler forcing
some order of initialization in an initializer list?

The language requires that sub-objects (bases and data members) are
initialized in the order they are declared. The order specified in an
initializer list does not matter. A compiler may warn you that you will
not get the order you have used in an initializer list.
To avoid such warnings, use the declaration order in every initializer list.
Cheers, & hth.,
- Alf
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
.

User: "Ian Collins"

Title: Re: Warning this will be initialized after that 05 Feb 2008 08:08:40 PM
Christopher wrote:

What causes this kind of warning to occur? why is the compiler forcing
some order of initialization in an initializer list?
I frequently run into this when I am initializing a pointer and an int
in a constructor's initializer list.

Class members are initialised in the order they are declared, not the
order they appear in initialiser lists.
--
Ian Collins.
.


  Page 1 of 1

1

 


Related Articles
Re: C/C++ compiler that will work with Atmel STK500
Re: C/C++ compiler that will work with Atmel STK500
Re: C/C++ compiler that will work with Atmel STK500
Re: Parsing a file stream that increases
maps that don't insert default items
The destruction of a sub instantiated obj that =?iso-8859-1?Q?I=92m?=pointing too.
software that interect with outlook express
hylafax question--- how to distingish faxes belong to A or B or C ......Z if the same faxes no is employed so that I can email to inform to read their fax via internet ....
Need to write a function that adjusts words in a string array
A function that returns a pointer...??
i have problem that two thread use one charactor pointer for string buffer
Problems to find out code changes that seems not to lead into a bug but does ?
String or char[] - that is the question
Problem in deleting the dynamic memory in a parent thread that is allocated from a child thread
SQL oriented scripting language that can be executed from a C++ code
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER