21

Quoting from the book I'm reading:

  1. signed char, signed short int, signed int, signed long int, signed long long int are called standard signed integer types
  2. unsigned char, unsigned short int, unsigned int, unsigned long int, unsigned long long int, _Bool are called standard unsigned integer types
  3. In addition to the standard integer types, the C99 standard allows implementation-defined extended integer types, both signed and unsigned. For example, a compiler might be provide signed and unsigned 128-bit integer types.

I've problem with 3rd point. What are these "extended integer types"? Any examples?

Tom Karzes
  • 22,815
  • 2
  • 22
  • 41
claws
  • 52,236
  • 58
  • 146
  • 195

2 Answers2

7

Extended integer types are implementation-specific integer types that are provided as an extension. Because almost everything about such extensions is implementation-defined, the standard can’t say much about them. However, a C++09 proposal provides a framework for implementing such extensions in a way that doesn’t interfere with the behavior of standard compliant programs.

you should refer this,which covers everything about extended integer types.

Community
  • 1
  • 1
joey rohan
  • 3,505
  • 5
  • 33
  • 70
6

An example of the extended integer type is the __int64 64-bit signed integer type defined by MS Visual C. While this type is obviously an integral type, in older versions of MSVC it could not be obtained as int, long int, nor long long int. (MSVC added support for long long int in the meantime.)

user4815162342
  • 141,790
  • 18
  • 296
  • 355
  • 6
    This is not the best example as `MSVC` is c90 and c90 doesn't have *extended integer types*. They were introduced in c99. – ouah Nov 15 '12 at 19:21
  • 2
    @ouah Good point. I suppose it would be more correct to say that extended integer types were introduced to cover such a case. – user4815162342 Nov 15 '12 at 19:35
  • 5
    note: also `__int128` that may be defined by gcc is *not* extended integer types because [GCC does not support any extended integer types](https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html). – jfs Oct 02 '14 at 09:57
  • 1
    @J.F.Sebastian Thanks for the link. I wonder if this is a documentation oversight for platforms where GCC defines `__int128`. Except for the documentation claiming otherwise, it has all traits of an extended integer type: it implements integer arithmetic, it is not an alias for one of the standard integer types, it comes in signed and unsigned variety, it has a fixed width, and it is represented in binary. If it looks like a duck... – user4815162342 Oct 02 '14 at 12:29
  • 8
    @user4815162342: `sizeof(intmax_t)` may be less than `sizeof(__int128)` on gcc. It rules out the possibility that `__int128` is an extended integer type. – jfs Oct 02 '14 at 12:48