Where to check if type long long is defined? I wanna do something like this:
#ifdef LONGLONG
#define long_long long long
#else
#define long_long long
#endif
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
LLONG_MAXgives the maximum value representable by along long; if your implementation doesn’t supportlong long, it shouldn’t defineLLONG_MAX.This isn’t a perfect solution.
long longisn’t standard in C++03, andlong longhas been around longer than C99, so it’s possible (and likely) that a compiler could supportlong longbut not defineLLONG_MAX.If you want an integer type with a specific size, you should use
<stdint.h>if your implementation supports it. If your implementation doesn’t support it, Boost has an implementation of it.