![]() |
probleme de macro avec cast !!! argh !!!!!
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
![]()
g un big pb ac une macro et je c pa trop d'ou ca vient... doit y avoir un pb de cast ou de pointeur...
voila le code : typedef struct { char type; union { float type0; int type1; }; } param; #define GetIntFloat(variable) variable.type==0 ? variable.type0 : variable.type1 int main(int argc, char* argv[]) { // pour les float param paramFloat; paramFloat.type = 0; paramFloat.type0 = 123.4; float f = GetIntFloat(paramFloat); // pour les int param paramInt; paramInt.type = 1; paramInt.type1 = 123; int i = GetIntFloat(paramInt); printf("float=%f\tint=%d\n", f,i); system("pause"); return 0; } jusque là, ce code marche, mais si maintenant je change le printf par : printf("float=%f\tint=%d\n", GetIntFloat(paramFloat), GetIntFloat(paramInt)); eh ben ca marche pu ! prtant au dessus le GetIntFloat retourne bien un float ou un int selon ce qui a ét décidé... ac ce printf, le GetIntFloat ne marche pas pr le INT... snif... qqun pourrait-il m'aider svp ??? |
#2
|
||||
|
||||
Re: probleme de macro avec cast !!! argh !!!!!
C'est sans doute une suggestion nulle, étant donné que ça fait 4 ans que je n'ai pas fait de C :
Code:
printf("float=%f\tint=%d\n", float GetIntFloat(paramFloat), int GetIntFloat(paramInt)); |
![]() |
Bookmarks |
«
Previous Thread
|
Next Thread
»
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cours de français | Benjy | Discussions sur le site et/ou le forum | 47 | 01-05-2006 14:47 |
Petit probléme avec outlook express !!! | Alexlesioux | Internet, Réseaux et Sécurité | 11 | 31-08-2004 07:16 |
Probleme de Raid avec MSI K7T266 Pro2 RU | Lionel-78 | Windows NT4/2000/XP Client | 0 | 03-04-2003 12:01 |
Probléme de lenteurs... | chalouf | Discussions sur le site et/ou le forum | 11 | 22-01-2003 19:37 |
Probleme site!! | chalouf | Discussions sur le site et/ou le forum | 4 | 21-10-2002 21:06 |
All times are GMT +2. The time now is 18:24.
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.