Are there types bigger than long long int in C++?

前端 未结 9 790
遥遥无期
遥遥无期 2020-12-08 13:18

Are there types bigger than long long int in C++?

My compiler is g++.

9条回答
  •  余生分开走
    2020-12-08 13:38

    Standards

    Extended integer types are explicitly allowed by the C and C++ standards.

    C++11

    C++11 N3337 draft 3.9.1 "Fundamental types" paragraph 3 says:

    There are five standard signed integer types : “signed char”, “short int”, “int”, “long int”, and “long long int”. In this list, each type provides at least as much storage as those preceding it in the list. There may also be implementation-defined extended signed integer types. The standard and extended signed integer types are collectively called signed integer types. Plain ints have the natural size suggested by the architecture of the execution environment the other signed integer types are provided to meet special needs.

    You should also consider intmax_t, which 18.4.1 "Header synopsis" paragraph 2 says:

    The header defines all functions, types, and macros the same as 7.18 in the C standard.

    C99

    C99 N1256 draft explicitly allows them at 6.2.5 "Types" paragraph 4:

    There are five standard signed integer types, designated as signed char, short int, int, long int, and long long int. (These and other types may be designated in several additional ways, as described in 6.7.2.) There may also be implementation-defined extended signed integer types.28) The standard and extended signed integer types are collectively called signed integer types.29)

    and 7.18.1.5 "Greatest-width integer types" paragraph 1 says:

    The following type designates a signed integer type capable of representing any value of any signed integer type:

    intmax_t

提交回复
热议问题