由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - macro and std:: function name clashing
相关主题
is MAX_INT standard macro for getting max_int in C++scala下一代compiler dotty
问低级问题师傅们,C++概念题,弟子有礼了
c++ define 一问关于Makefile的一个问题
新版的 eclipse 有什么大的改进?关于C++ STL编译的疑问
C pre-compiling 如何用macro替换括号?ask a question about compile shared library using libtool
c++ template是不是跟Macro一个道理?vc 2008: compilation error about header file
Visual studio: 2008: create a macro in compiler configurationsize of structure
c++中的inline 函数是做什么的?Question about friend in C++
相关话题的讨论汇总
话题: std话题: max话题: numeric话题: macro话题: clashing
进入Programming版参与讨论
1 (共1页)
j****i
发帖数: 305
1
I'm using clapack where some macros like min, max, abs etc are defined. When
I include the f2c.h and clapack.h headers the gcc compiler complains that
the std::numeric_limits::max() in my own code does not have enough
number of arguments for the macro "max". The compiler uses the "max" defined
in the f2c.h instead of using the one in std, even though I specified the
namespace and class numeric_limits when I call the max().
I "fixed" this problem by removing all the calls to std::numeric_
a**********s
发帖数: 588
2
No expert, but did you try this:
(numeric_limits::max)();
??
j****i
发帖数: 305
3
I don't have access to the computer I was testing lapack. I can try what you
suggested and I think it might work, since
max has no "(" followed.
But what about the complex class in c++, which I cannot and do not want to
change. In that class the std::abs() function is used. There got to be a way
to solve this systematically.

【在 a**********s 的大作中提到】
: No expert, but did you try this:
: (numeric_limits::max)();
: ??

X****r
发帖数: 3557
4
If you don't use these macros in your own code, just undefine them before
including header files that contains functions with the same name.

you
to
way

【在 j****i 的大作中提到】
: I don't have access to the computer I was testing lapack. I can try what you
: suggested and I think it might work, since
: max has no "(" followed.
: But what about the complex class in c++, which I cannot and do not want to
: change. In that class the std::abs() function is used. There got to be a way
: to solve this systematically.

1 (共1页)
进入Programming版参与讨论
相关主题
Question about friend in C++C pre-compiling 如何用macro替换括号?
最初级的白痴C++问题c++ template是不是跟Macro一个道理?
请教有关header file的几个问题Visual studio: 2008: create a macro in compiler configuration
C语言重复定义问题c++中的inline 函数是做什么的?
is MAX_INT standard macro for getting max_int in C++scala下一代compiler dotty
问低级问题师傅们,C++概念题,弟子有礼了
c++ define 一问关于Makefile的一个问题
新版的 eclipse 有什么大的改进?关于C++ STL编译的疑问
相关话题的讨论汇总
话题: std话题: max话题: numeric话题: macro话题: clashing