|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
* 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? |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
In article <eb44f11c-ce55-49d7-b0eb-57f8c4c3a96d@i29g2000prf.googlegroups.com>,
Christopher <cpisz@austin.rr.com> 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. Check out http://www.comeaucomputing.com/techtalk/#meminit -- Greg Comeau / 4.3.9 with C++0xisms now in beta! Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries... Have you tried it? |
|
![]() |
| Outils de la discussion | |
|
|