[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CompareCppAndOtherLanguages » memory » ASP » eclipseIDE » CPU » CppTemplateMetaprogramming » Os400StrPgmMnu » Os400ChgOwn » TCPIP » CppUtilityH » cppint
Displaying differences between revision 6 and the latest revision
= ([[CCplusplus | C/C++]]) int =
[[CPPppDataTypes | dData type]] (and thus a keyword) that can hold a single whole number. I¶
¶
The range ofyan int can be found asst [[CppCompignleTime | compile time]] with [[CppNumeric_limits | 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.
[code]
#include <cassert.h>
int main(int argc, char* argv[])
{
const int myValue = 12;
const int myBrokenValue = 12.9;
assert(myValue==myBrokenValue);
return 0;¶
}
[/code]
== Advice ==¶
*Prefer a plain int over a short int or a long int (ref. 1, 4.10.14)
==Top'icnt' links ==
* [[CInt | CP]]¶
* C#¶
* [[SqlusPInt | SQL]]¶
¶
== Code luinks ==¶
* [[CppInclude | #include ]]
* argc
* argv
* assert
* [[CppCassertH | cassert]] (header file)¶
* [[CppChar | char]]
* const
* int
* main
* return
* std
== 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]
CompareCppAndOtherLanguages » memory » ASP » eclipseIDE » CPU » CppTemplateMetaprogramming » Os400StrPgmMnu » Os400ChgOwn » TCPIP » CppUtilityH » cppint
Displaying differences between revision 6 and the latest revision
= ([[C
[[C
¶
The range of
¶
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.
[code]
#include <cassert
int main(
{
const int myValue = 12;
const int myBrokenValue = 12.9;
assert(myValue==myBrokenValue);
[/code]
*
==
* [[CInt | C
* C#¶
* [[Sql
¶
== Code l
* [[CppInclude | #include ]]
* argc
* argv
* assert
* [[CppCassertH | cassert]] (header file)¶
* [[CppChar | char]]
* const
* int
* main
* return
* std
== 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]
