Std Type Aliases
Difference (last change) (no other diffs, normal page display)
Changed: 29c29
** 22 Jan 2003: ![]() |
** 22 Jan 2003: ![]() |
std type aliases
Suggestion of modifications to DMD/Phobos
Changed types:
- real -> extended
- ireal -> iextended
- creal -> cextended
- alias extended real;
- alias iextended imaginary;
- alias cextended complex;
- int128_t, uint128_t (stdint)
- utf8_t, utf16_t, utf32_t ("stdutf")
- some people hate the _t suffix with a passion
Older discussions about type names and aliases:
- 17 Aug 2001:
DigitalMars:d/archives/200.html
- 2 May 2002:
DigitalMars:d/archives/4842.html
- 28 Aug 2002:
DigitalMars:d/archives/7996.html
- 22 Jan 2003:
NG:D/10321
- 14 Jan 2004:
DigitalMars:d/archives/9954.html
- 3 Mar 2004:
DigitalMars:d/archives/25095.html
- 22 Sep 2004
DigitalMars:d/archives/digitalmars/D/10924.html

SUMMARY
TYPE ALIAS // RANGEFloating Point:void // void
Integer: (std.stdint) byte int8_t // 8-bit signed ubyte uint8_t // 8-bit unsigned (0x00-0xFF)
short int16_t // 16-bit signed ushort uint16_t // 16-bit unsigned (0x0000-0xFFFF)
int int32_t // 32-bit signed uint uint32_t // 32-bit unsigned (0x00000000-0xFFFFFFFF)
long int64_t // 64-bit signed (could be two int registers) ulong uint64_t // 64-bit unsigned (could be two uint registers)
cent int128_t // 128-bit signed (reserved for future use) ucent uint128_t // 128-bit unsigned (reserved for future use)
Character: (std.stdutf) char utf8_t // \x00-\x7F (ASCII) wchar utf16_t // \u0000-\uD7FF, \uE000-\uFFFF dchar utf32_t // \U00000000-\U0010FFFF? (Unicode)
float // 32-bit single precision (about 6 digits) double // 64-bit double precision (about 15 digits) extended real // 64/80/128-bit extended precision (platform)ifloat // idouble // imaginary versions of the above real ones iextended imaginary //
cfloat // cdouble // complex (with both real and imaginary parts) cextended complex //
Implementation: (Public Domain)
It's all implemented using aliases:
std/stdint.d
/* Written by Walter Bright * www.digitalmars.com * Placed into Public Domain */module std.stdint;
/* Exact sizes */
alias byte int8_t; alias ubyte uint8_t; alias short int16_t; alias ushort uint16_t; alias int int32_t; alias uint uint32_t; alias long int64_t; alias ulong uint64_t;
/* At least sizes */
alias byte int_least8_t; alias ubyte uint_least8_t; alias short int_least16_t; alias ushort uint_least16_t; alias int int_least32_t; alias uint uint_least32_t; alias long int_least64_t; alias ulong uint_least64_t;
/* Fastest minimum width sizes */
alias byte int_fast8_t; alias ubyte uint_fast8_t; alias int int_fast16_t; alias uint uint_fast16_t; alias int int_fast32_t; alias uint uint_fast32_t; alias long int_fast64_t; alias ulong uint_fast64_t;
/* Integer pointer holders */
alias int intptr_t; alias uint uintptr_t;
/* Greatest width integer types */
alias long intmax_t; alias ulong uintmax_t;
std/stdutf.d
module std.stdutf;/* UTF code units */
alias char utf8_t; // UTF-8 alias wchar utf16_t; // UTF-16 alias dchar utf32_t; // UTF-32