Click here to Skip to main content
15,922,894 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: typedef for Function Pointer Pin
Gary R. Wheeler1-Oct-04 12:39
Gary R. Wheeler1-Oct-04 12:39 
GeneralRe: typedef for Function Pointer Pin
Jörgen Sigvardsson1-Oct-04 12:50
Jörgen Sigvardsson1-Oct-04 12:50 
GeneralRe: typedef for Function Pointer Pin
Michael Dunn1-Oct-04 14:03
sitebuilderMichael Dunn1-Oct-04 14:03 
GeneralRe: typedef for Function Pointer Pin
Gary R. Wheeler2-Oct-04 2:00
Gary R. Wheeler2-Oct-04 2:00 
GeneralDLL problem Pin
Larsson1-Oct-04 10:36
Larsson1-Oct-04 10:36 
GeneralRe: DLL problem Pin
ThatsAlok1-Oct-04 18:30
ThatsAlok1-Oct-04 18:30 
GeneralRe: DLL problem Pin
Larsson1-Oct-04 22:16
Larsson1-Oct-04 22:16 
General#define style templates and float Pin
J.B.1-Oct-04 9:15
J.B.1-Oct-04 9:15 
Hi guys,

I tried to compile and run a #define type templates example code in Visual C++:

#include <iostream>

#define define_max(type)	\
	type max(type d1, type d2) { \
		if (d1 > d2)	\
			return (d1); \
		return (d2);	\
	}

define_max(int);
define_max(float);
define_max(char);

int main(void)
{
	int i = max(100, 800);
	char ch = max('A', 'Q');
	float f = max(3.5, 8.7);

	return 0;
}

and I am getting compile error ambiguous call to overloaded function on the line
float f = max(3.5, 8.7);

If I replace float with double, it will compile and run ok. Does anyone know why that is? Is there some kind of limitation on uses of float in Visual C++?

Thanks alot
GeneralRe: #define style templates and float Pin
David Crow1-Oct-04 9:35
David Crow1-Oct-04 9:35 
GeneralRe: #define style templates and float Pin
vcplusplus1-Oct-04 10:26
vcplusplus1-Oct-04 10:26 
GeneralRe: #define style templates and float Pin
J.B.1-Oct-04 19:46
J.B.1-Oct-04 19:46 
QuestionHow slow is GDI? Pin
Budric B.1-Oct-04 6:13
Budric B.1-Oct-04 6:13 
AnswerRe: How slow is GDI? Pin
Nathan Holt at EMOM1-Oct-04 6:29
Nathan Holt at EMOM1-Oct-04 6:29 
GeneralRe: That did it! Pin
Budric B.1-Oct-04 6:48
Budric B.1-Oct-04 6:48 
GeneralRe: Movie playing software Pin
Nathan Holt at EMOM1-Oct-04 7:05
Nathan Holt at EMOM1-Oct-04 7:05 
GeneralChanging window shapes and colors Pin
V.G1-Oct-04 5:31
V.G1-Oct-04 5:31 
GeneralRe: Changing window shapes and colors Pin
BlackDice1-Oct-04 6:35
BlackDice1-Oct-04 6:35 
GeneralRe: Changing window shapes and colors Pin
V.G1-Oct-04 7:17
V.G1-Oct-04 7:17 
GeneralRe: Changing window shapes and colors Pin
BlackDice1-Oct-04 8:25
BlackDice1-Oct-04 8:25 
GeneralLinking issues Pin
JensB1-Oct-04 4:21
JensB1-Oct-04 4:21 
GeneralRe: Linking issues Pin
valikac1-Oct-04 5:32
valikac1-Oct-04 5:32 
GeneralRe: Linking issues Pin
Anonymous2-Oct-04 12:07
Anonymous2-Oct-04 12:07 
Generaltemplate as a friend? (Expert question:) Pin
Boniolopez1-Oct-04 3:59
Boniolopez1-Oct-04 3:59 
GeneralRe: template as a friend? (Expert question:) Pin
valikac1-Oct-04 5:36
valikac1-Oct-04 5:36 
Generalany borland helpers Pin
porac691-Oct-04 2:47
porac691-Oct-04 2:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.