Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2123 connectés 

  FORUM HardWare.fr
  Programmation
  C++

  Cherche option obscure de g++

 


 Mot :   Pseudo :  
 
 Page :   1  2
Page Précédente
Auteur Sujet :

Cherche option obscure de g++

n°529748
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 21:26:54  profilanswer
 

Voila j'ai besoin de visualiser un bout de code utilisant des templates APRES leur instanciations. Y a t il une option de gcc pour farie ca ??


Message édité par Joel F le 02-10-2003 à 21:27:11
mood
Publicité
Posté le 02-10-2003 à 21:26:54  profilanswer
 

n°529754
Taz
bisounours-codeur
Posté le 02-10-2003 à 21:30:41  profilanswer
 

visualiser sous quelle forme ?

n°529757
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 21:34:17  profilanswer
 

ben du style templates instanciés :
 
Code original

Code :
  1. template<int T> void test()
  2. {
  3.   std::cout << R << std::endl;
  4.   test<T-1>();
  5. }
  6. template<> void test<0>()
  7. {
  8.   std::cout << 0 << std::endl;
  9. }
  10. int main(int,char**)
  11. {
  12.   test<10>();
  13.   return 0;
  14. }


 
Moi je veux :

Code :
  1. int main(int,char**)
  2. {
  3.   std::cout << 10 << std::endl;
  4.   std::cout << 9 << std::endl;
  5.   std::cout << 8 << std::endl;
  6.   std::cout << 7 << std::endl;
  7.   std::cout << 6 << std::endl;
  8.   std::cout << 5 << std::endl;
  9.   std::cout << 4 << std::endl;
  10.   std::cout << 3 << std::endl;
  11.   std::cout << 2 << std::endl;
  12.   std::cout << 1 << std::endl;
  13.   std::cout << 0 << std::endl;
  14.   return 0;
  15. }


 
evidemmment la le template est bidon, moi j'ai enormement de template imbriqués etc ...
 
EDIT : correction sur test()


Message édité par Joel F le 02-10-2003 à 23:17:15
n°529762
Taz
bisounours-codeur
Posté le 02-10-2003 à 21:37:54  profilanswer
 

je pense que tout ça est impossible, les templates, c'est pas du simple préprocesseur, je pense que tout ça se passe dans la machinerie interne de gcc au niveau du code intermédaire.
 
l'assembleur ça te suffit pas ? sinon y a une option pour avoir la liste des templates instanciés il me semble (avec -frepo, etc)

n°529764
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 21:39:08  profilanswer
 

-frepo ca m'aide pas ...
l'assembleur, bah c un peu obscur pour ce que je veux faire...
et j'ai besoin d'une trace qqconque pour lui prouver que les templates se deroulent proprement.
 
Mais je pense aussi que c DMC :-/


Message édité par Joel F le 02-10-2003 à 21:39:41
n°529765
Taz
bisounours-codeur
Posté le 02-10-2003 à 21:41:14  profilanswer
 

en tout cas ça m'intéresse une technique pour le déroulage des templates. peut etre en émettant un message d'erreur si c'est possible

n°529766
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 21:41:53  profilanswer
 

en tout cas #error et #warning  ca marche pas :-/

n°529778
Taz
bisounours-codeur
Posté le 02-10-2003 à 21:49:17  profilanswer
 

normal, ça se passe avec le prépo. le tout serait peut etre d'utiliser un static_warning (peut etre ce de boost) dans certains bou de code.
 
frepo ça te suffit pas ? tu connais un demangler d'ailleurs ? ou faut en écrire un? g++ respect le name-mangling ISO ?

n°529782
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 21:51:19  profilanswer
 

Taz a écrit :

normal, ça se passe avec le prépo. le tout serait peut etre d'utiliser un static_warning (peut etre ce de boost) dans certains bou de code.


Je vais tenté d'utiliser un Compile Time assert.
 

Taz a écrit :


tu connais un demangler d'ailleurs ?  
ou faut en écrire un?  
g++ respect le name-mangling ISO ?


 
je sais pas.
je sais pas.
je sais pas.
 
 [:t%40merenslip]

n°529788
Taz
bisounours-codeur
Posté le 02-10-2003 à 21:53:35  profilanswer
 

si ça marche, colle un bout de code pour l'exemple bidon, je mate Sphère, que j'ai pas à m'embêter pour essayer. :D
 
 
pour le reste, faudrait chercher quand même

mood
Publicité
Posté le 02-10-2003 à 21:53:35  profilanswer
 

n°529792
Taz
bisounours-codeur
Posté le 02-10-2003 à 21:55:55  profilanswer
 

c++filt :sol:

n°529802
Taz
bisounours-codeur
Posté le 02-10-2003 à 22:08:29  profilanswer
 

bizarre
 

Code :
  1. #include <iostream>
  2. template<int T>
  3. void test()
  4.   std::cout << T << std::endl;
  5.   test<T-1>();
  6. }
  7.  
  8. template<>
  9. void test<0>()
  10.   std::cout << 0 << std::endl;
  11. }
  12.  
  13. int main()
  14. {
  15.   test<10>();
  16. }


 
 
sans inline
 
[benoit@athlon tmp]$ g++ -frepo -O0 -Winline -c test.cpp  
[benoit@athlon tmp]$ c++filt < test.rpo | grep test
M test.cpp
O void test<9>()
O void test<10>()
 
 
avec inline
 
[benoit@athlon tmp]$ g++ -frepo -O0 -Winline -c test.cpp  
[benoit@athlon tmp]$ c++filt < test.rpo | grep test
M test.cpp
O void test<1>()
O void test<2>()
O void test<3>()
O void test<4>()
O void test<5>()
O void test<6>()
O void test<7>()
O void test<8>()
O void test<9>()
O void test<10>()

n°529803
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 22:08:35  profilanswer
 

Bingo !
merci boost :
 

Code :
  1. #include <iostream>
  2. #include <boost/static_assert.hpp>
  3. template<int T> void test()
  4.    std::cout << T << std::endl;
  5.    BOOST_STATIC_ASSERT(false);
  6.    test<T-1>();
  7. }
  8.  
  9. template<> void test<0>()
  10.    std::cout << 0 << std::endl;
  11.    BOOST_STATIC_ASSERT(false);
  12. }
  13. int main(int argc, char *argv[])
  14. {
  15.   test<10>(); 
  16.   system("PAUSE" );
  17.   return 0;
  18. }


 
en sortie :
 

Code :
  1. main.cpp: In function `void test() [with int T = 0]':
  2. main.cpp:25: `sizeof' applied to incomplete type `
  3.    boost::STATIC_ASSERTION_FAILURE<false>'
  4. main.cpp: In function `void test() [with int T = 10]':
  5. main.cpp:32:   instantiated from here
  6. main.cpp:18: `sizeof' applied to incomplete type `
  7.    boost::STATIC_ASSERTION_FAILURE<false>'
  8. main.cpp: In function `void test() [with int T = 9]':
  9. main.cpp:19:   instantiated from `void test() [with int T = 10]'
  10. main.cpp:32:   instantiated from here
  11. main.cpp:18: `sizeof' applied to incomplete type `
  12.    boost::STATIC_ASSERTION_FAILURE<false>'
  13. main.cpp: In function `void test() [with int T = 8]':
  14. main.cpp:19:   instantiated from `void test() [with int T = 9]'
  15. main.cpp:19:   instantiated from `void test() [with int T = 10]'
  16. main.cpp:32:   instantiated from here
  17. main.cpp:18: `sizeof' applied to incomplete type `
  18.    boost::STATIC_ASSERTION_FAILURE<false>'
  19. main.cpp: In function `void test() [with int T = 7]':
  20. main.cpp:19:   instantiated from `void test() [with int T = 8]'
  21. main.cpp:19:   instantiated from `void test() [with int T = 9]'
  22. main.cpp:19:   instantiated from `void test() [with int T = 10]'
  23. main.cpp:32:   instantiated from here
  24. main.cpp:18: `sizeof' applied to incomplete type `
  25.    boost::STATIC_ASSERTION_FAILURE<false>'
  26. main.cpp: In function `void test() [with int T = 6]':
  27. main.cpp:19:   instantiated from `void test() [with int T = 7]'
  28. main.cpp:19:   instantiated from `void test() [with int T = 8]'
  29. main.cpp:19:   instantiated from `void test() [with int T = 9]'
  30. main.cpp:19:   instantiated from `void test() [with int T = 10]'
  31. main.cpp:32:   instantiated from here
  32. main.cpp:18: `sizeof' applied to incomplete type `
  33.    boost::STATIC_ASSERTION_FAILURE<false>'
  34. main.cpp: In function `void test() [with int T = 5]':
  35. main.cpp:19:   instantiated from `void test() [with int T = 6]'
  36. main.cpp:19:   instantiated from `void test() [with int T = 7]'
  37. main.cpp:19:   instantiated from `void test() [with int T = 8]'
  38. main.cpp:19:   instantiated from `void test() [with int T = 9]'
  39. main.cpp:19:   instantiated from `void test() [with int T = 10]'
  40. main.cpp:32:   instantiated from here
  41. main.cpp:18: `sizeof' applied to incomplete type `
  42.    boost::STATIC_ASSERTION_FAILURE<false>'
  43. main.cpp: In function `void test() [with int T = 4]':
  44. main.cpp:19:   instantiated from `void test() [with int T = 5]'
  45. main.cpp:19:   instantiated from `void test() [with int T = 6]'
  46. main.cpp:19:   instantiated from `void test() [with int T = 7]'
  47. main.cpp:19:   instantiated from `void test() [with int T = 8]'
  48. main.cpp:19:   instantiated from `void test() [with int T = 9]'
  49. main.cpp:19:   instantiated from `void test() [with int T = 10]'
  50. main.cpp:32:   instantiated from here
  51. main.cpp:18: `sizeof' applied to incomplete type `
  52.    boost::STATIC_ASSERTION_FAILURE<false>'
  53. main.cpp: In function `void test() [with int T = 3]':
  54. main.cpp:19:   instantiated from `void test() [with int T = 4]'
  55. main.cpp:19:   instantiated from `void test() [with int T = 5]'
  56. main.cpp:19:   instantiated from `void test() [with int T = 6]'
  57. main.cpp:19:   instantiated from `void test() [with int T = 7]'
  58. main.cpp:19:   instantiated from `void test() [with int T = 8]'
  59. main.cpp:19:   instantiated from `void test() [with int T = 9]'
  60. main.cpp:19:   instantiated from `void test() [with int T = 10]'
  61. main.cpp:32:   instantiated from here
  62. main.cpp:18: `sizeof' applied to incomplete type `
  63.    boost::STATIC_ASSERTION_FAILURE<false>'
  64. main.cpp: In function `void test() [with int T = 2]':
  65. main.cpp:19:   instantiated from `void test() [with int T = 3]'
  66. main.cpp:19:   instantiated from `void test() [with int T = 4]'
  67. main.cpp:19:   instantiated from `void test() [with int T = 5]'
  68. main.cpp:19:   instantiated from `void test() [with int T = 6]'
  69. main.cpp:19:   instantiated from `void test() [with int T = 7]'
  70. main.cpp:19:   instantiated from `void test() [with int T = 8]'
  71. main.cpp:19:   instantiated from `void test() [with int T = 9]'
  72. main.cpp:19:   instantiated from `void test() [with int T = 10]'
  73. main.cpp:32:   instantiated from here
  74. main.cpp:18: `sizeof' applied to incomplete type `
  75.    boost::STATIC_ASSERTION_FAILURE<false>'
  76. main.cpp: In function `void test() [with int T = 1]':
  77. main.cpp:19:   instantiated from `void test() [with int T = 2]'
  78. main.cpp:19:   instantiated from `void test() [with int T = 3]'
  79. main.cpp:19:   instantiated from `void test() [with int T = 4]'
  80. main.cpp:19:   instantiated from `void test() [with int T = 5]'
  81. main.cpp:19:   instantiated from `void test() [with int T = 6]'
  82. main.cpp:19:   instantiated from `void test() [with int T = 7]'
  83. main.cpp:19:   instantiated from `void test() [with int T = 8]'
  84. main.cpp:19:   instantiated from `void test() [with int T = 9]'
  85. main.cpp:19:   instantiated from `void test() [with int T = 10]'
  86. main.cpp:32:   instantiated from here
  87. main.cpp:18: `sizeof' applied to incomplete type `
  88.    boost::STATIC_ASSERTION_FAILURE<false>'

n°529805
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 22:09:44  profilanswer
 

Taz a écrit :

bizarre
sans inline
 
[benoit@athlon tmp]$ g++ -frepo -O0 -Winline -c test.cpp  
[benoit@athlon tmp]$ c++filt < test.rpo | grep test
M test.cpp
O void test<9>()
O void test<10>()
 
 
avec inline
 
[benoit@athlon tmp]$ g++ -frepo -O0 -Winline -c test.cpp  
[benoit@athlon tmp]$ c++filt < test.rpo | grep test
M test.cpp
O void test<1>()
O void test<2>()
O void test<3>()
O void test<4>()
O void test<5>()
O void test<6>()
O void test<7>()
O void test<8>()
O void test<9>()
O void test<10>()


 
-ftemplate-deph-32 :o ??

n°529808
Taz
bisounours-codeur
Posté le 02-10-2003 à 22:13:59  profilanswer
 

ne change rien.  
 
remets ta signature, je t'ai encore sauvé la vie

n°529809
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 22:14:43  profilanswer
 

arf c vrai :D

n°529811
Taz
bisounours-codeur
Posté le 02-10-2003 à 22:20:48  profilanswer
 

tu as quoi comme version de g++, de boost ? moi j'ai le message, mais pas sa provenance

n°529812
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 22:25:27  profilanswer
 

Dev C++ version 4.9.8.0
Boost 1.3.0
 
regarde dans l'onglet "Compiler Log"

n°529813
Taz
bisounours-codeur
Posté le 02-10-2003 à 22:26:05  profilanswer
 

tu te fout de ma gueule là :o

n°529814
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 22:27:31  profilanswer
 

pourquoi ??? :o

n°529816
schnapsman​n
Zaford Beeblefect
Posté le 02-10-2003 à 22:27:47  profilanswer
 

Joel F a écrit :

Dev C++ version 4.9.8.0
Boost 1.3.0
 
regarde dans l'onglet "Compiler Log"


 
toi un windozien, quel gachis, t'es pas un vrai  :pfff:


---------------
From now on, you will speak only when spoken to, and the first and last words out of your filthy sewers will be "Sir!"
n°529818
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 22:28:10  profilanswer
 

???
et tu sais quoi, j'ai meme desinstallé vc6 pour remettre emacs, gcc, les gnu tools.
j'utilise wget et meme gnuplot sur mon win2k  :kaola:


Message édité par Joel F le 02-10-2003 à 22:28:45
n°529819
schnapsman​n
Zaford Beeblefect
Posté le 02-10-2003 à 22:29:42  profilanswer
 

Joel F a écrit :

???
et tu sais quoi, j'ai meme desinstallé vc6 pour remettre emacs, gcc, les gnu tools.
j'utilise wget et meme gnuplot sur mon win2k  :kaola:  


 
à quoi bon utiliser du tainted gnu ?


---------------
From now on, you will speak only when spoken to, and the first and last words out of your filthy sewers will be "Sir!"
n°529820
Taz
bisounours-codeur
Posté le 02-10-2003 à 22:30:06  profilanswer
 

dire que tu pourrais avoir Debian sur tes x86 et PPC :pfff:

n°529821
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 22:30:50  profilanswer
 

J'aime pas Linux :p

n°529822
Taz
bisounours-codeur
Posté le 02-10-2003 à 22:32:00  profilanswer
 

[:xx_xx]

n°529823
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 22:34:25  profilanswer
 

et oui, ca me fait chier c tout, moi c Mac Os X ou W2k ou rien na !


Message édité par Joel F le 02-10-2003 à 22:39:20
n°529826
Taz
bisounours-codeur
Posté le 02-10-2003 à 22:36:16  profilanswer
 

[:heink] Linux est le plus rapide des Unix pour Macintosh. Même remarque pour Windows ... ça doit pas être la fête tous les jours. tu baisses dans mon estime.

n°529827
Taz
bisounours-codeur
Posté le 02-10-2003 à 22:36:37  profilanswer
 

:heink:

n°529830
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 22:40:05  profilanswer
 

Taz a écrit :

[:heink] Linux est le plus rapide des Unix pour Macintosh. Même remarque pour Windows ... ça doit pas être la fête tous les jours. tu baisses dans mon estime.


 
ben ecoute j'ai eu enormement d eprobleme avec pas mald e distrib ...
 
si tu veux tu me donne une bonne distrib et on en parle plus, je partitionne mon dur et je tente l'expereince :p

n°529831
Taz
bisounours-codeur
Posté le 02-10-2003 à 22:41:56  profilanswer
 

bah Debian, à moins que tu n'es pas le niveau. les dernières RH et Mdk sont très fonctionnelles

n°529833
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 22:43:44  profilanswer
 

Taz a écrit :

bah Debian, à moins que tu n'es pas le niveau.


 
c'est à dire "le niveau" ... ?
RH :vomi: ...  
Mandrake merci bien ...


Message édité par Joel F le 02-10-2003 à 22:44:02
n°529839
Taz
bisounours-codeur
Posté le 02-10-2003 à 22:52:07  profilanswer
 

ben pourquoi tu aimes pas ces distributions ?

n°529841
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 22:53:51  profilanswer
 

Red Hat je l'ai eu au boulot, ct merdique ... lent au possible.
Mandrake ben tt le monde m'en dit du mal.

n°529843
Taz
bisounours-codeur
Posté le 02-10-2003 à 22:55:12  profilanswer
 

lent ? :heink:
ben essaye Debian. Mdk et RH sont bien quoi qu'on en dise...

n°529845
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 22:57:35  profilanswer
 

OK, je tente debian sur le 2e PC on verra bien :D
 
 
de tt maniere g qd mem besin de win2k donc bon :p

n°529851
Taz
bisounours-codeur
Posté le 02-10-2003 à 22:59:16  profilanswer
 

on doit pas avoir la même définition de ce qui est bon. t'en es réduit à devoir installer gcc sous Windows pour devoir travailler, moi j'aurais pas réfléchi longtemps

n°529860
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 23:03:11  profilanswer
 

ecoute, je doit aussi develloper des DLL win32 et plus souvent que de faire des test ss gcc.
 
J'utilise principalement gcc au boulot sur le Mac donc bon ...

n°529867
schnapsman​n
Zaford Beeblefect
Posté le 02-10-2003 à 23:05:37  profilanswer
 

oauis mais sur tes ordos persos c'est quand même la honte :o


---------------
From now on, you will speak only when spoken to, and the first and last words out of your filthy sewers will be "Sir!"
n°529871
Joel F
Real men use unique_ptr
Posté le 02-10-2003 à 23:06:38  profilanswer
 

excuse moi mais non ....
je vois pas ce qui a de honteux d'utiliser windows 2000 avec des outils gnu ou gcc ou tt ce que je veux.
Franchement, c'est vous qui me decevez ... extremistes nerdz :o


Message édité par Joel F le 02-10-2003 à 23:07:02
mood
Publicité
Posté le   profilanswer
 

 Page :   1  2
Page Précédente

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  C++

  Cherche option obscure de g++

 

Sujets relatifs
Cherche projets ASP en open sourceCherche ame charitable
Cherche Visual Basic 4,5,ou 6 avec licence[divers] cherche conseil pour un jeu
Je cherche le contraire de Asc()cherche personne savan utiliser tre bien le html
cherche éditeur de script avec 'Traitement par lot'[Java][Swing] cherche idée pour garder un focus clavier [résoudu]
cherche cours de programmationJe cherche des passionnés
Plus de sujets relatifs à : Cherche option obscure de g++


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR