A
Anonyme
Invité
J'ai fait une fonction à nombre de paramètres variable. voici le code :
Je l'utilise ici :
Quand je compile (gcc), il me met trois warning :
Et quand je lance le prog, il s'arrête juste à l'appel de la fonction (pas dedans) : "Illegal instruction"
Grrrr... :mad:
Help :zen:
Bloc de code:
#include <cstdarg>
[...]
template<typename T>
void rajoutTab (vector<T> &tab, size_t comb, ...) {
va_list ap;
va_start(ap, comb);
for (size_t i = 0; i < comb; i++) {
tab.push_back(va_arg(ap, T));
}
va_end(ap);
}
Je l'utilise ici :
Bloc de code:
Triangle::Triangle (Nombre un, Nombre deux, Nombre trois, bool rect) {
vector<Nombre> tmpTab;
rajoutTab(tmpTab, 3, un, deux, trois); [COLOR="Red"]//le warning est ici[/COLOR]
[...]
Quand je compile (gcc), il me met trois warning :
Bloc de code:
/Users/fabrice/Desktop/Dropbox/Public/Site/Code/C++/iMath/iMath/ObjsCalcLigne.cpp:248: warning: cannot pass objects of non-POD type 'class Nombre' through '...'; call will abort at runtime
/Users/fabrice/Desktop/Dropbox/Public/Site/Code/C++/iMath/iMath/ObjsCalcLigne.cpp:248: warning: cannot pass objects of non-POD type 'class Nombre' through '...'; call will abort at runtime
/Users/fabrice/Desktop/Dropbox/Public/Site/Code/C++/iMath/iMath/ObjsCalcLigne.cpp:248: warning: cannot pass objects of non-POD type 'class Nombre' through '...'; call will abort at runtime
Et quand je lance le prog, il s'arrête juste à l'appel de la fonction (pas dedans) : "Illegal instruction"
Grrrr... :mad:
Help :zen: