This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Can the use of "long long" be ifdef'd, please?

Tags: None
(comma "," separated)
dmbates
Registered Member
Posts
24
Karma
0
OS
Lines 83 and 84 in Eigen/src/Core/util/Meta.h use the unsigned and signed long long type in templates and this causes gcc-4.5 with -std=c++98, the default value, to issue a warning that long long is not supported in the ISO C++ 1998 standard.

Unfortunately I am not sure of what name to use to check for support of long long or I would ifdef those lines myself.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
yes, you are right, we should rather use std::int64_t.
mattd
Registered Member
Posts
28
Karma
0
ggael: be careful, if your intent is for the int64_t specialization of ei_is_arithmetic to cover the long long int it will not work in general (you still need a separate specialization for long long int):
http://stackoverflow.com/questions/4160 ... vs-int64-t
mattd
Registered Member
Posts
28
Karma
0
Incidentally, have you considered using std::numeric_limits::is_specialized for the purposes of the ei_is_arithmetic template?

// is_specialized is a static const bool data member of std::numeric_limits class template

It seems to cover what you want by definition -- ISO/IEC 14882:2003(E) states:

"Integral and floating types are collectively called arithmetic types. Specializations of the standard template numeric_limits (18.2) shall specify the maximum and minimum values of each arithmetic type for an implementation." // 3.9.1/8

"Specializations shall be provided for each fundamental type, both floating point and integer, including bool. The member is_specialized shall be true for all such specializations of numeric_limits." // 18.2.1/2

"The member is_specialized makes it possible to distinguish between fundamental types, which have specializations, and non-scalar types, which do not." // 18.2.1.1/1


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]