Reputation: 401
So, I am trying to locate the limit.h file that has the numeric_limits defined. I seem to find all different flavors of the limit.h but not the defined one, as shown in http://en.cppreference.com/w/cpp/types/numeric_limits
I am on debian distro.
Here is what I have done so far. I created a main.cpp
with only #include <limits>
Did a g++ verbose build to find all the include path:
g++ -v main.cpp -o tryout
.
Now I see that /usr/include
and usr/lib
has bunch of limits.h files. But none of them seem to have the template definition I am looking for
in /usr/include/
% find -name limits.h
returns the following :
./c++/4.4/tr1/limits.h
./limits.h
./linux/limits.h
in /usr/lib
% find -name limits.h
returns the following:
./perl5/Tk/pTk/compat/limits.h
./gcc/x86_64-linux-gnu/4.3/include-fixed/limits.h
./gcc/x86_64-linux-gnu/4.4/include-fixed/limits.h
So where is the std::numeric_limits
template located. How do I find that file.
Upvotes: 1
Views: 3038
Reputation: 47448
As the reference page shows, std::numeric_limits
is defined in the header <limits>
, not limits.h
. You can find where it is by asking the preprocessor, for example:
~$ cat test.cc
#include <limits>
~$ g++ -E test.cc -o - | grep limits | grep gcc | tail -1
# 841 "/opt/swt/install/gcc-4.7.2/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c++/4.7.2/limits" 3
Upvotes: 2