Hi all, currently I am studying data type for my case in database.
A bit of my world:
Platform System Z (IBM), x32 and x64 (AMD & Intel)
Programming Pascal, C, C#, Java
Database DB2, Oracle, MSSql, Postgresql, MySql
Messaging and Serialization
Scope:
1. Size toward 64 bit, 32 bit become legacy
2. Byte Ordering 95% today we used Little Endian Processor (current office)
3. Naming which is my current problem in mapping
What I like about Pascal is a language that can communicate.
for example in a world of processor
from AMD64 Architecture Programmer's Manual Volume 1: Application Programming Page 37 3.2.1 Fundamental Data Types
from Intel 64 adn IA-32 Architectures Software Developer's Manual, Volume 1: Basic Architecture Vol 1 4-1 Data Types
datum (bits) 256 128 80 64 48 32 16 8
---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ----------------
untyped double octword octword quadword doubleword word byte
floating point double extended double precision single precision half precision
in pascal we can map to
datum (bits) 256 128 80 64 48 32 16 8
---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ----------------
untyped qword dword word byte
unsigned integer uint64 uint32 uint16 uint8
signed integer int64 int32 int16 int8
floating point extended double single
(feel connect here?) Nice isnt it, cause its already declare in system unit.
the first problem is how I develope mental map size for type, how about next 128 and 256 bit?
uuid can be read in singgle register, future of exabyte,
and according to
https://en.wikipedia.org/wiki/Longest_word_in_Englishcomputer can read word, at least in Longest word in a major dictionary, not spell byte
also today AVX2 already available (xmm, ymm, zmm)
Just now I have in mind is bit, nibble, byte, word, dual (double), quad, and octo
For our Brother C of course theres ctypes unit, so I would not prove it again.
But I admit, a bit dangling, maybe C is A la la la la long after B long long long.
after playing crossword this come to mind, uint128 in C
doublesquidword, ulonglonglong, doublestackbigmac (just kidding).
in Free Pascal theres also boolean not just 8 bit size, which complete the table to
datum (bits) 256 128 80 64 48 32 16 8
---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ---------------- ----------------
untyped qword dword word byte
unsigned integer uint64 uint32 uint16 uint8
signed integer int64 int32 int16 int8
floating point extended double single
boolean qwordbool longbool wordbool bytebool
boolean64 boolean32 boolean16 boolean8
cardinal qword longword word byte
integer int64 longint smallint shortint
Now my question arise, why int64? is there any other name?
refer to
https://www.espressoenglish.net/difference-between-big-small-long-short-tall-huge-and-tiny/I need Vitamin C.
Naming
thanks to alias feature, may be we can create one?
but what a rose if I cant smell it? doh.
refer to system.fpd, system.inc (RTTI), systemh.inc,
I prefer use this order for aliasing, and add some puzzle.
Byte = UInt8 = 0..255;
Word = UInt16 = 0..65535;
x32 Cardinal = Longword = UInt32 = 0..4294967295;
x64 ? = QWord = UInt64 = 0..18446744073709551615;
x128 ? = ? = UInt128 =
Shortint = Int8 = -128 .. 127;
Smallint = Int16 = -32768 .. 32767;
x32 Integer = Longint = Int32 = -2147483648..2147483647;
x64 ? = ? = Int64 = -9223372036854775808..9223372036854775807;
x128 ? = ? = Int128 =
First candidate BigInt adapted from database, or also LargeInt, with some add alias for tinyint.
Second a pattern already in FPC, I have to adapt Dual to Long equal 32 bit,
learn from bool, so is QWordInt or QInt.
quad long word byte
boolean qwordbool longbool wordbool bytebool
cardinal qword longword word byte
qint longword word byte
integer qwordint longint smallint shortint
(See the pattern?) or how about octo and quad, with some new alias in other type
octo quad long word byte
boolean octobool quadbool longbool wordbool bytebool
cardinal octoword quadword longword word byte
integer octoint quadint longint wordint byteint
(Is it eazy to map size?)
Note:
boolean8 is not defined
for boolean if input with true false, the result is correct.
but for using low function the result is different if we mean low = false and high = true.
vBytebool := low(Bytebool); // Error: Asm: byte value exceeds bounds 9223372036854775807
vWordbool := low(Wordbool); // Error: Asm: byte value exceeds bounds 9223372036854775807
vLongbool := low(Longbool); // FALSE but TRUE
vQuadbool := low(Quadbool); // Return TRUE
I know naming can be bless (Work legacy from Adam) or curse (Of Babel Tower),
I need input from others too, feel free to fill in,
Is it BigInt, LargeInt, QWordInt, QInt, QuadInt, or any other proper name?
or just stick to Int64?
Many thanks in advanced.