Topic: Why isn't the nonspecialized numeric_limits empty?


Author: kprateek88@yahoo.com (Prateek R Karandikar)
Date: Sat, 12 Jun 2004 18:21:18 +0000 (UTC)
Raw View
Anything wrong in it being empty?

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
To iterate is human, to recurse divine.
-L. Peter Deutsch
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

---
[ 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.jamesd.demon.co.uk/csc/faq.html                       ]





Author: tslettebo@hotmail.com (Terje Sletteb?)
Date: Sun, 13 Jun 2004 20:36:19 +0000 (UTC)
Raw View
kprateek88@yahoo.com (Prateek R Karandikar) wrote in message news:<607f883e.0406120927.2a4bd460@posting.google.com>...
> Anything wrong in it being empty?

std::numeric_limts has a lot of problems, also, besides this, such as
min/max not being integral constant expressions (althought Boost has a
component that fixes this:
http://www.boost.org/libs/integer/integer_traits.html). See e.g.:
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#201

"[post-Toronto: The opinion of the LWG is that the wording in the
standard, as well as the wording of the proposed resolution, is
flawed. The term "arithmetic types" is well defined in C and C++, and
it is not clear that the term is being used correctly. It is also not
clear that the term "implementation dependent" has any useful meaning
in this context. The biggest problem is that numeric_limits seems to
be intended both for built-in types and for user-defined types, and
the standard doesn't make it clear how numeric_limits applies to each
of those cases. A wholesale review of numeric_limits is needed. A
paper would be welcome.]"

as well as:

http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#184 (bool
is neither signed nor unsigned)

There was also a thread about numeric_limits a few years ago
(http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=73611vs31id2ejf4qjpbpatcml4jadgluc%404ax.com).

Regards,

Terje

---
[ 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.jamesd.demon.co.uk/csc/faq.html                       ]





Author: kprateek88@yahoo.com (Prateek R Karandikar)
Date: Wed, 19 May 2004 20:18:31 +0000 (UTC)
Raw View
Why isn't nonspecialized numeric_limits empty? All its members ( of
the nonspecialized class) are meaningless anyway. The nonspecialized
char_traits is empty. Why not numeric_limits? Or both (char_traits and
numeric_limits) could have declared and not defined :

template<typename T> struct numeric_limits;

template<> struct numeric_limits<bool> {/*...*/};
/*...*/

Why do the numeric_limits specializations for integral types also have
members relevant only to only floating-point types? It seems wierd to
talk about numeric_limits<int>::round_error.

---
[ 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.jamesd.demon.co.uk/csc/faq.html                       ]