[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
Commodore » WhatLinksHere » Atari » GNU » CppPublic » Dennis Ritchie » ImaginaryNumber » BeginnersGuideToVBNet » pixel » RAD » cppint
The range of an int can be found at compile time with std::numeric_limits.
If you assign a broken number to an int, this value gets rounded down. Your compiler should give you a warning then, as in the example below.
Prefer a plain int over a short int or a long int (ref. 1, 4.10.14)
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
Commodore » WhatLinksHere » Atari » GNU » CppPublic » Dennis Ritchie » ImaginaryNumber » BeginnersGuideToVBNet » pixel » RAD » cppint
(C++) int
Data type (and thus a keyword) that can hold a single whole number.The range of an int can be found at compile time with std::numeric_limits.
If you assign a broken number to an int, this value gets rounded down. Your compiler should give you a warning then, as in the example below.
int main() { const int myValue = 12; const int myBrokenValue = 12.9; assert(myValue==myBrokenValue); }
- include <cassert>
Prefer a plain int over a short int or a long int (ref. 1, 4.10.14)
'int' links
Code links
Reference
- 1) Bjarne Stroustrup. The C++ Programming Language (3rd edition).ISBN: 0-201-88954-4
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
