A
Alex Vinokur
Hi,
Here is my program
-------------- Program --------------
#define ADD(x,t) (x + t)
template <typename T, int N>
int foo()
{
return sizeof(T) * N;
}
int main()
{
int v1 = 5 + foo<int,10>();
int v2 = ADD(5, foo<int,10>());
return 0;
}
-----------------------------------------
Here is a compilation log
Compiler: aCC: HP C/aC++ B3910B A.06.15 [May 16 2007]
------------ Compilation log -----------------
"foo7.cpp", line 12: warning #2055-D: too many arguments in macro
invocation
int v2 = ADD(5, foo<int,10>());
^
"foo7.cpp", line 12: error #2439: expected a ">"
int v2 = ADD(5, foo<int,10>());
^
1 error detected in the compilation of "foo7.cpp".
---------------------------------------------------
Program after preprocessig
---------------------------------
template <typename T, int N>
int foo()
{
return sizeof(T) * N;
}
int main()
{
int v1 = 5 + foo<int,10>();
int v2 = (5 + foo<int); // Why?
return 0;
}
Here is my program
-------------- Program --------------
#define ADD(x,t) (x + t)
template <typename T, int N>
int foo()
{
return sizeof(T) * N;
}
int main()
{
int v1 = 5 + foo<int,10>();
int v2 = ADD(5, foo<int,10>());
return 0;
}
-----------------------------------------
Here is a compilation log
Compiler: aCC: HP C/aC++ B3910B A.06.15 [May 16 2007]
------------ Compilation log -----------------
"foo7.cpp", line 12: warning #2055-D: too many arguments in macro
invocation
int v2 = ADD(5, foo<int,10>());
^
"foo7.cpp", line 12: error #2439: expected a ">"
int v2 = ADD(5, foo<int,10>());
^
1 error detected in the compilation of "foo7.cpp".
---------------------------------------------------
Program after preprocessig
---------------------------------
template <typename T, int N>
int foo()
{
return sizeof(T) * N;
}
int main()
{
int v1 = 5 + foo<int,10>();
int v2 = (5 + foo<int); // Why?
return 0;
}