What is the meaning of "l" in some variables initialization - C++ -
this question has answer here:
what meaning of "l" in variable initialisations? example:
#define maxpossible (1000000000l) double = 1l; double b = 999999999l;
is there difference between "l" , "l"?
this suffix type specifier, a
, b
can read more floating point literals here. short answer l
, l
both indicate long double
. maxpossible
can read integer literal here , l
indicates long
.
edit
as mike seymour kindly pointed out of literals integer
literals. goes show times when not sanity check answer, wrong. simple sanity check have been follows:
#include <iostream> #include <typeinfo> int main() { std::cout << typeid( decltype( 1l ) ).name() << std::endl ; std::cout << typeid( decltype( 999999999l ) ).name() << std::endl ; std::cout << typeid( decltype( 1000000000l ) ).name() << std::endl ; }
which gives me l
each 1 , running through c++filt -t
gives me long
. have made literals floating point literals? either a:
- digits containing decimal point
- digits exponential notation, example
4e2
for example:
std::cout << typeid( decltype( .1l ) ).name() << std::endl ; std::cout << typeid( decltype( 1e2l ) ).name() << std::endl ;
which gives me e
both cases , running through c++filt -t
gives me long double
.
Comments
Post a Comment