Re: Whose idea to make it a function?
kanze wrote:
Greg Herlihy wrote:
..
The problem is that the same interface is imposed on
std::numeric_limit<char>::max. And there are a lot of things
you could do with that if it weren't a function.
The reason std::numeric_limit<>::max is a function is simple:
there are implementations where it is impossible to determine
the value until runtime---implementations where runtime options
may affect it.
The fact that numeric limits are also available as macros in <cfloat>
rules out the possibility of numeric_limits::max() performing any kind
of runtime check. There is only ony limit per program per type. So how
could DBL_MAX and std::numeric_limits<double>::max() ever disagree
without at least one of them being incorrect?
A numeric limit is a superlative property of a specific type and of a
specific program - the greatest (or least) value of that type
encountered in any of the program's possible execution states. Runtime
options simply multiply the number of a program's execution states, but
do not eliminate any that already exist. So the only way to change a
set of limits for a program is to change the program itself - and for
most development environments - that means recompilation.
Greg
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]