PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > Warning this will be initialized after that
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Warning this will be initialized after that

Réponse
 
LinkBack Outils de la discussion
Vieux 06/02/2008, 01h51   #1
Christopher
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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.
  Réponse avec citation
Vieux 06/02/2008, 01h59   #2
Alf P. Steinbach
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Warning this will be initialized after that

* 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?
  Réponse avec citation
Vieux 06/02/2008, 02h08   #3
Ian Collins
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Warning this will be initialized after that

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.
  Réponse avec citation
Vieux 06/02/2008, 15h01   #4
Greg Comeau
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Warning this will be initialized after that

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?
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 12h23.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10975 seconds with 12 queries