IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C++ Discussion :

[struct]warnings à éliminer


Sujet :

C++

  1. #1
    Membre expérimenté
    Avatar de GLDavid
    Homme Profil pro
    Service Delivery Manager
    Inscrit en
    Janvier 2003
    Messages
    2 885
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Service Delivery Manager
    Secteur : Industrie Pharmaceutique

    Informations forums :
    Inscription : Janvier 2003
    Messages : 2 885
    Par défaut [struct]warnings à éliminer
    Bonjour

    Me voici à refaire un peu de C++.
    Je suis sous Linux et je compile avec g++.
    Mon problème est le suivant: j'ai écrit ce fichier header A.h:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
     
    #ifndef FINDBEACON_H_
    #define FINDBEACON_H_
     
    #include <string>
    #include "PrimersResults.h"
     
    struct ArgumentsB
    {
      int Tm, TmTol, TaOpt, TaOptTol, MinLenAmp, MaxLenAmp, GCclamp, MabinAmp, RmLen, MppTmm, MinLenPrim, MaxLenPrim, MinGC, MaxGC;
      double HmdG3pEnd, HmdGIntern, SdmdG3pEnd, SdmdGIntern, _3pEndmSdG, CdmdG3pEnd, CdmdGIntern, PrimConc, MgConc, NaConc;
      std::string FileName;
     
      bool Init(int argc, const char* argv[]);
      ArgumentsB(int argc, const char* argv[]);
    };
     
    #endif /*FINDBEACON_H_*/
    Puis, dans le fichier A.cpp, je fais:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
     
    #include "A.h"
     
    bool ArgumentsB::Init(int argc, const char* argv[])
      {
        using namespace Args;
     
        ArgumentParser parser;
     
        parser.addArgument ( "-infile=", Argument(1, true) );
        parser.addArgument ( "-Tm=", Argument(1, false) );
        parser.addArgument ( "-TmTol=", Argument(1, false) );
        parser.addArgument ( "-TaOpt=", Argument(1, false) );
        parser.addArgument ( "-TaOptTol=", Argument(1, false) );
    	parser.addArgument ( "-MinLenAmp=", Argument(1, false) );
        parser.addArgument ( "-MaxLenAmp=", Argument(1, false) );
        parser.addArgument ( "-HmdG3pEnd=", Argument(1, false) );
        parser.addArgument ( "-HmdGIntern=", Argument(1, false) );
        parser.addArgument ( "-SdmdG3pEnd=", Argument(1, false) );
        parser.addArgument ( "-SdmdGIntern=", Argument(1, false) );
        parser.addArgument ( "-RmLen=", Argument(1, false) );
        parser.addArgument ( "-GCclamp=", Argument(1, false) );
        parser.addArgument ( "-3pEndmSdG=", Argument(1, false) );
        parser.addArgument ( "-MabinAmp=", Argument(1, false) );
        parser.addArgument ( "-MppTmm=", Argument(1, false) );
    	parser.addArgument ( "-CdmdG3pEnd=", Argument(1, false) );
        parser.addArgument ( "-CdmdGIntern=", Argument(1, false) );
        parser.addArgument ( "-MinLenPrim=", Argument(1, false) );
        parser.addArgument ( "-MaxLenPrim=", Argument(1, false) );
        parser.addArgument ( "-MinGC=", Argument(1, false) );
        parser.addArgument ( "-MaxGC=", Argument(1, false) );
        parser.addArgument ( "-PrimConc=", Argument(1, false) );
        parser.addArgument ( "-MgConc=", Argument(1, false) );
        parser.addArgument ( "-NaConc=", Argument(1, false) );
     
        if(!parser.Parse(argc, argv)) return false;
        {
          const Argument& arg=parser.getArgument("-infile=");
          FileName = arg.getValue(0);
        }
        {
          const Argument& arg=parser.getArgument("-Tm=");
          if( arg.isInitiated() ) {
    	Tm=arg.getInteger(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-TmTol=");
          if( arg.isInitiated() ) {
    	TmTol=arg.getInteger(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-TaOpt=");
          if( arg.isInitiated() ) {
    	TaOpt=arg.getInteger(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-TaOptTol=");
          if( arg.isInitiated() ) {
    	TaOptTol=arg.getInteger(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-MinLenAmp=");
          if( arg.isInitiated() ) {
    	MinLenAmp=arg.getInteger(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-MaxLenAmp=");
          if( arg.isInitiated() ) {
    	MaxLenAmp=arg.getInteger(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-HmdG3pEnd=");
          if( arg.isInitiated() ) {
    	HmdG3pEnd=arg.getDouble(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-HmdGIntern=");
          if( arg.isInitiated() ) {
    	HmdGIntern=arg.getDouble(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-SdmdG3pEnd=");
          if( arg.isInitiated() ) {
    	SdmdG3pEnd=arg.getDouble(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-SdmdGIntern=");
          if( arg.isInitiated() ) {
    	SdmdGIntern=arg.getDouble(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-RmLen=");
          if( arg.isInitiated() ) {
    	RmLen=arg.getInteger(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-GCclamp=");
          if( arg.isInitiated() ) {
    	GCclamp=arg.getInteger(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-3pEndmSdG=");
          if( arg.isInitiated() ) {
    	_3pEndmSdG=arg.getDouble(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-MabinAmp=");
          if( arg.isInitiated() ) {
    	MabinAmp=arg.getInteger(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-MppTmm=");
          if( arg.isInitiated() ) {
    	MppTmm=arg.getInteger(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-CdmdG3pEnd=");
          if( arg.isInitiated() ) {
    	CdmdG3pEnd=arg.getDouble(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-CdmdGIntern=");
          if( arg.isInitiated() ) {
    	CdmdGIntern=arg.getDouble(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-MinLenPrim=");
          if( arg.isInitiated() ) {
    	MinLenPrim=arg.getInteger(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-MaxLenPrim=");
          if( arg.isInitiated() ) {
    	MaxLenPrim=arg.getInteger(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-MinGC=");
          if( arg.isInitiated() ) {
    	MinGC=arg.getInteger(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-MaxGC=");
          if( arg.isInitiated() ) {
    	MaxGC=arg.getInteger(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-PrimConc=");
          if( arg.isInitiated() ) {
    	PrimConc=arg.getDouble(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-MgConc=");
          if( arg.isInitiated() ) {
    	MgConc=arg.getDouble(0);
          }
        }
        {
          const Argument& arg=parser.getArgument("-NaConc=");
          if( arg.isInitiated() ) {
    	NaConc=arg.getDouble(0);
          }
        }
        return true;
      }
    L'ennui, c'est qu'à la compilation, j'obtiens l'erreur:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    FindBeacon.h: In constructor `ArgumentsB::ArgumentsB(int, const char**)':
    FindBeacon.h:10: attention : « ArgumentsB::SdmdGIntern » sera initialisé après
    FindBeacon.h:9: attention :   « ArgumentsB::RmLen »
    FindBeacon.cpp:243: attention :   lorsqu'initialisé ici
    FindBeacon.h:9: attention : « ArgumentsB::RmLen » sera initialisé après
    FindBeacon.h:9: attention :   « ArgumentsB::GCclamp »
    FindBeacon.cpp:243: attention :   lorsqu'initialisé ici
    FindBeacon.h:10: attention : « ArgumentsB::_3pEndmSdG » sera initialisé après
    FindBeacon.h:9: attention :   « ArgumentsB::MabinAmp »
    FindBeacon.cpp:243: attention :   lorsqu'initialisé ici
    FindBeacon.h:10: attention : « ArgumentsB::CdmdGIntern » sera initialisé après
    FindBeacon.h:9: attention :   « ArgumentsB::MinLenPrim »
    En fait, je ne vois pas trop comment supprimer ces wrnings.
    Pouvez-vous m'aider ?

    Merci d'avance.

    @++
    GLDavid
    Consultez la FAQ Perl ainsi que mes cours de Perl.
    N'oubliez pas les balises code :tagcode: ni le tag :resolu:

    Je ne répond à aucune question technique par MP.

  2. #2
    Membre émérite Avatar de Herode
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mars 2005
    Messages
    825
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2005
    Messages : 825
    Par défaut
    D'après les messages, le warning concerne l'ordre d'initialisation de tes variables dans le constructeur ArgumentB::ArgumentB(...) et non dans la méthode ArgumentB::Init(...).

    NB : si tu utilises une liste d'initialisation, il est possible que le compilateur râle lorsqu'il détecte que certaines variables sont dépendantes les unes des autres et que tu ne respectes pas l'ordre des dépendances dans tes initialisations.

  3. #3
    Membre expérimenté
    Avatar de GLDavid
    Homme Profil pro
    Service Delivery Manager
    Inscrit en
    Janvier 2003
    Messages
    2 885
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Service Delivery Manager
    Secteur : Industrie Pharmaceutique

    Informations forums :
    Inscription : Janvier 2003
    Messages : 2 885
    Par défaut
    Ok, merci Herode de ton aide. Je vais corriger ça.

    @++
    GLDavid
    Consultez la FAQ Perl ainsi que mes cours de Perl.
    N'oubliez pas les balises code :tagcode: ni le tag :resolu:

    Je ne répond à aucune question technique par MP.

  4. #4
    Membre expérimenté
    Avatar de GLDavid
    Homme Profil pro
    Service Delivery Manager
    Inscrit en
    Janvier 2003
    Messages
    2 885
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Service Delivery Manager
    Secteur : Industrie Pharmaceutique

    Informations forums :
    Inscription : Janvier 2003
    Messages : 2 885
    Par défaut
    Ok, j'ai d'abord initialisé dans mon constructeurs mes entiers puis mes doubles. Depuis, je n'ai plus d'erreur de la part du compilo.
    Merci encore herode !

    @++
    GLDavid
    Consultez la FAQ Perl ainsi que mes cours de Perl.
    N'oubliez pas les balises code :tagcode: ni le tag :resolu:

    Je ne répond à aucune question technique par MP.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. éliminer warning par bufférisation sortie
    Par laurentSc dans le forum Langage
    Réponses: 31
    Dernier message: 19/01/2012, 23h51
  2. [HashSet] Warning a éliminer
    Par freddy766 dans le forum Langage
    Réponses: 4
    Dernier message: 24/10/2006, 10h18
  3. Warnings lors de la compilation
    Par polo54 dans le forum C
    Réponses: 5
    Dernier message: 07/02/2003, 09h12
  4. éliminer un caractere d'un string
    Par no-vice dans le forum Langage
    Réponses: 5
    Dernier message: 09/08/2002, 14h55
  5. Problème avec [b]struct[/b]
    Par Bouziane Abderraouf dans le forum CORBA
    Réponses: 2
    Dernier message: 17/07/2002, 10h25

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo