For example:
long xx = ..; //is xx in range of an int type?
I came up w/ with this question in my mind, so it’s not really an interview question, as some of you may ask.
Basically I want to write the code to check it w/o using <climits>, e.g., INT_MIN, INT_MAX. What’s the portable, most effective way to do it, if not impossible?
By portable, I mean it shouldn’t be implementation defined or platform dependent, e.g., a byte is not always 8 bits.
1 Answer