Recent

Author Topic: Alias for Int64  (Read 9464 times)

Tz

  • Jr. Member
  • **
  • Posts: 54
  • Tz with FPC Pen Cil
Alias for Int64
« on: January 17, 2019, 12:52:51 pm »
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_English
computer 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.

« Last Edit: April 14, 2019, 04:53:42 pm by Tz »

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Alias for Int64
« Reply #1 on: January 17, 2019, 02:54:25 pm »
Apart from reading the language manuals I have no good advice apart from the fact that Boolean8 is now properly defined in trunk. (I asked for that)
Reading https://freepascal.org/docs-html/ref/refsu4.html may enlighten most - if not all - of your problems...
« Last Edit: January 17, 2019, 02:57:45 pm by Thaddy »
Specialize a type, not a var.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Alias for Int64
« Reply #2 on: January 17, 2019, 03:49:38 pm »
Funny typo in that page:
Code: Pascal  [Select][+][-]
  1. Name      Size   Ord(True)
  2. -----     ----   ----------
  3. Boolean     1     1
  4. Boolean8    1     1
  5. Boolean16   3     1
  6. Boolean32   4     1
  7. [etc.]
:D
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Alias for Int64
« Reply #3 on: January 18, 2019, 09:18:57 am »
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?

I prefer the ones that contain the bit size as for example I'm always guessing which one is Short and which one is SmallInt.

Funny typo in that page:
Code: Pascal  [Select][+][-]
  1. Name      Size   Ord(True)
  2. -----     ----   ----------
  3. Boolean     1     1
  4. Boolean8    1     1
  5. Boolean16   3     1
  6. Boolean32   4     1
  7. [etc.]
:D
This one is already fixed in trunk and will be part of the 3.2.0 documentation.

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Alias for Int64
« Reply #4 on: January 18, 2019, 11:34:23 am »
Apart from that type:I saw that the NativeInt and NativeUint family are also missing.
For completeness, these signed and unsigned types are always the native register size for  the cpu, e.g. 1 byte for 8 bit,2 for 16,4 for 32, 8 for 64.
They are still ordinals.

I will have to check the sources for trunk doc to check if this has been mitigated in the mean time.
Specialize a type, not a var.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Alias for Int64
« Reply #5 on: January 21, 2019, 09:12:06 am »
NativeInt and NativeUInt were only added for Delphi compatibility. The types we consider as the corresponding types for the processors native integer size are PtrInt and PtrUInt respectively.

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Alias for Int64
« Reply #6 on: January 21, 2019, 09:17:28 am »
I wrote "and family"   :D but of course you are correct.
Doesn't mean they are not missing in that particular part of the docs.
 
« Last Edit: January 21, 2019, 09:19:45 am by Thaddy »
Specialize a type, not a var.

Tz

  • Jr. Member
  • **
  • Posts: 54
  • Tz with FPC Pen Cil
Re: Alias for Int64
« Reply #7 on: April 12, 2019, 04:27:38 pm »

@PascalDragon yes as for other language too:

Code: Pascal  [Select][+][-]
  1.  .Net Type  C#          Java        Kotlin      Golang      Swift       FPC*
  2. Boolean     bool        boolean     Boolean     Bool        Bool        Boolean
  3. Char        char        char        Char                    Character   Char
  4. Byte        byte                    UByte       Byte                    Byte
  5.                                                 Uint8       UInt8       UInt8
  6. UInt16      ushort                  UShort      Uint16      UInt16      UInt16
  7. UInt32      uint                    UInt        Uint32      UInt32      UInt32
  8. UInt64      ulong                   ULong       Uint64      UInt64      UInt64
  9. Sbyte       sbyte       byte        Byte        Int8        Int8        Int8
  10. Int16       short       short       Short       Int16       Int16       Int16
  11. Int32       int         int         Int         Int32       Int32       Int32
  12. Int64       long        long        Long        Int64       Int64       Int64
  13. Single      float       float       Float       Float32     Float       Single
  14. Double      double      double      Double      Float64     Double      Double
  15.                                                                         Extended
  16. Decimal     decimal                 BigDecimal  Complex128  Decimal     BigDecimal ?
  17.                                                                         Currency
  18. String      string      String      String      String      String      String
  19. Object      object      object      Object                              TObject
  20. DateTime    DateTime    Date        Date        Time        Date        TDateTime
  21. Guid        Guid        UUID        UUID        UUID        UUID        TGuid
  22.  
  23.  

Kotlin unsigned still experimental
Pascal BigDecimal http://www.rvelthuis.de/programs/bigdecimals.html

@Thaddy I missed read types.pp there is LargeInt and LargeUInt :)

I just want use what FPC already define, so for simplicity I just use as list in FPC*
and want to try using TypeHelper its a nice thing.


@lucamar I just wait for update :) thanks for the info


Thank you all.

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Alias for Int64
« Reply #8 on: April 12, 2019, 09:37:34 pm »
FPC (and Delphi) calls a int8 a ShortInt -128..127 and int16 a SmallInt -32768..32767. Int8 and Int16 are mere aliases for these fundamental types. There are more in the list
« Last Edit: April 12, 2019, 09:39:46 pm by Thaddy »
Specialize a type, not a var.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Alias for Int64
« Reply #9 on: April 12, 2019, 10:33:15 pm »
Delphi has the int* types since afaik Delphi XE or so (2011,12?). FPC since 2.6.2.

I'm very happy with it, I was also always mixing small and short. Note that integer is an alias for int16 or int32 depending on mode.

It maybe wouldn't be a bad thing long term to make the int* types the fundamental compiler know types, and the old TP and OldDelphi names aliases (e.g. so that the byzantine names don't spill over into non turbo modes). Though probably that would mean an implicit unit (with these aliases) for the default (TP,FPC) modes too.

If I can remember correctly, FPC for Power5 has int128 support.

Tz

  • Jr. Member
  • **
  • Posts: 54
  • Tz with FPC Pen Cil
Re: Alias for Int64
« Reply #10 on: April 13, 2019, 05:33:23 am »
@marcov for me, using helper, native taste like an object

in  OBJFPC world

Code: Pascal  [Select][+][-]
  1. type
  2.  
  3. // OBJFPC        Native       Pointer     Dynamic Array  
  4.  
  5.    TBoolean    = Boolean;  // PBoolean    TBooleanDynArray
  6.    TChar       = Char;     // PChar
  7.    TByte       = Byte;     // PByte       TByteDynArray     TBytes ??
  8.  
  9.    TUInt8      = UInt8;    // PUInt8
  10.    TUInt16     = UInt16;   // PUInt16
  11.    TUInt32     = UInt32;   // PUInt32
  12.    TUInt64     = UInt64;   // PUInt64
  13.  
  14.    TInt8       = Int8;     // PInt8
  15.    TInt16      = Int16;    // PInt16
  16.    TInt32      = Int32;    // PInt32
  17.    TInt64      = Int64;    // PInt64      TInt64DynArray
  18.  
  19.    TSingle     = Single;   // PSingle     TSingleDynArray
  20.    TDouble     = Double;   // PDouble     TDoubleDynArray
  21.    TExtended   = Extended; // PExtended   TExtendedDynArray
  22.  
  23.    TCurrency   = Currency; // PCurrency   TCurrencyArray ? not TCurrencyDynArray
  24. // TDateTime               // PDateTime
  25. // TGuid                   // PGuid
  26.  
  27. // TObject                 // PObject
  28.    TString     = String;   // PString     TStringDynArray
  29.    TPointer    = Pointer;  // PPointer    TPointerDynArray
  30.  
  31. {
  32.    TCharDynArray     = array of Char; ???
  33.    TChars            = array of Char; ???
  34.  
  35.    TUInt8DynArray    = array of UInt8;
  36.    TUInt16DynArray   = array of UInt16;
  37.    TUInt32DynArray   = array of UInt32;
  38.    TUInt64DynArray   = array of UInt64;
  39.  
  40.    TInt8DynArray     = array of Int8;
  41.    TInt16DynArray    = array of Int16;
  42.    TInt32DynArray    = array of Int32;
  43.  
  44.    TCurrencyDynArray = array of Currency;
  45.    TDateTimeDynArray = array of TDateTime;
  46.    TGuidDynArray     = array of TGuid;
  47. }
  48.  
  49. var
  50.  
  51.    VBoolean    :TBoolean;
  52.    VChar       :TChar;
  53.    VByte       :TByte;
  54.  
  55.    VUInt8      :TUInt8;
  56.    VUInt16     :TUInt16;
  57.    VUInt32     :TUInt32;
  58.    VUInt64     :TUInt64;
  59.  
  60.    VInt8       :TInt8;
  61.    VInt16      :TInt16;
  62.    VInt32      :TInt32;
  63.    VInt64      :TInt64;
  64.  
  65.    VSingle     :TSingle;
  66.    VDouble     :TDouble;
  67.    VExtended   :TExtended;
  68.  
  69.    VCurrency   :TCurrency;
  70.    VDateTime   :TDateTime;
  71.    VGuid       :TGuid;
  72.  
  73.    VObject     :TObject;
  74.    VString     :TString;
  75.    VPointer    :TPointer;
  76.  
  77.  

:T act like prefix ( :T = is Type )








Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Alias for Int64
« Reply #11 on: April 13, 2019, 07:17:17 am »
Note we also have the architecture dependent types NativeInt and NativeUint and family. On 64 bit systems this is int64 and Uint64 respectively, etc.
Specialize a type, not a var.

Tz

  • Jr. Member
  • **
  • Posts: 54
  • Tz with FPC Pen Cil
Re: Alias for Int64
« Reply #12 on: April 13, 2019, 09:08:57 am »
Ok next, learn helper.

@Thaddy   add Native

Code: Pascal  [Select][+][-]
  1. unit zTypes;
  2. {
  3.    OBJFPC      Pointer     Dynamic Array
  4.    ----------- ----------- -----------------
  5.    TBoolean    PBoolean    TArrayOfBoolean
  6.    TChar       PChar       TArrayOfChar
  7.    TByte       PByte       TArrayOfByte
  8.  
  9.    TUInt8      PUInt8      TArrayOfUInt8
  10.    TUInt16     PUInt16     TArrayOfUInt16
  11.    TUInt32     PUInt32     TArrayOfUInt32
  12.    TUInt64     PUInt64     TArrayOfUInt64
  13.  
  14.    TInt8       PInt8       TArrayOfInt8
  15.    TInt16      PInt16      TArrayOfInt16
  16.    TInt32      PInt32      TArrayOfInt32
  17.    TInt64      PInt64      TArrayOfInt64
  18.  
  19.    TSingle     PSingle     TArrayOfSingle
  20.    TDouble     PDouble     TArrayOfDouble
  21.  
  22.    TCurrency   PCurrency   TArrayOfCurrency
  23.    TDateTime   PDateTime   TArrayOfDateTime
  24.    TGuid       PGuid       TArrayOfGuid
  25.  
  26.    TString     PString     TArrayOfString
  27.    TObject     PObject     TArrayOfObject
  28.    TPointer    PPointer    TArrayOfPointer
  29.  
  30.    * depends on the processor type
  31.    TNativeUInt PNativeUInt TArrayOfNativeUInt
  32.    TNativeInt  PNativeInt  TArrayOfNativeInt
  33.    TExtended   PExtended   TArrayOfExtended
  34.  
  35.    * have to find Dynamic Record with serialization
  36. }
  37. interface
  38.  
  39. type
  40.  
  41.    TBoolean             = Boolean;
  42.    TChar                = Char;
  43.    TByte                = Byte;
  44.  
  45.    TUInt8               = UInt8;
  46.    TUInt16              = UInt16;
  47.    TUInt32              = UInt32;
  48.    TUInt64              = UInt64;
  49.  
  50.    TInt8                = Int8;
  51.    TInt16               = Int16;
  52.    TInt32               = Int32;
  53.    TInt64               = Int64;
  54.  
  55.    TSingle              = Single;
  56.    TDouble              = Double;
  57.  
  58.    TCurrency            = Currency;
  59.  
  60.    TString              = AnsiString;
  61.    TPointer             = Pointer;
  62.  
  63.    TNativeUInt          = NativeUInt;
  64.    TNativeInt           = NativeInt;
  65.    TExtended            = Extended;
  66.  
  67. // Dynamic Array
  68.  
  69.    TArrayOfBoolean      = array of TBoolean;
  70.    TArrayOfChar         = array of TChar;
  71.    TArrayOfByte         = array of TByte;
  72.  
  73.    TArrayOfUInt8        = array of TUInt8;
  74.    TArrayOfUInt16       = array of TUInt16;
  75.    TArrayOfUInt32       = array of TUInt32;
  76.    TArrayOfUInt64       = array of TUInt64;
  77.  
  78.    TArrayOfInt8         = array of TInt8;
  79.    TArrayOfInt16        = array of TInt16;
  80.    TArrayOfInt32        = array of TInt32;
  81.    TArrayOfInt64        = array of TInt64;
  82.  
  83.    TArrayOfSingle       = array of TSingle;
  84.    TArrayOfDouble       = array of TDouble;
  85.  
  86.    TArrayOfCurrency     = array of TCurrency;
  87.    TArrayOfDateTime     = array of TDateTime;
  88.    TArrayOfGuid         = array of TGuid;
  89.  
  90.    TArrayOfString       = array of TString;
  91.    TArrayOfObject       = array of TObject;
  92.    TArrayOfPointer      = array of TPointer;
  93.  
  94.    TArrayOfNativeUInt   = array of TNativeUInt;
  95.    TArrayOfNativeInt    = array of TNativeInt;
  96.    TArrayOfExtended     = array of TExtended;
  97.  
  98. implementation
  99.  
  100. end.
  101.  
  102.  

Tz

  • Jr. Member
  • **
  • Posts: 54
  • Tz with FPC Pen Cil
Re: Alias for Int64
« Reply #13 on: April 14, 2019, 07:10:00 am »
After some test, seem a lot work have to do
Currently no helper for Char, Curenncy, and TDateTime

For Boolean no MinValue = 0 or MaxValue = 1

UInt64 and NativeUInt invalid MaxSize
Int64 and NativeInt64 invalid MinSize and MaxSize


Types        Value Not Initialize = Ordinal Value
-----------  ----------------------------------------------
Boolean    : FALSE = 0 : TRUE = 1
Char       :  = 0
Byte       : 0 = 0
UInt8      : 0 = 0
UInt16     : 0 = 0
UInt32     : 0 = 0
UInt64     : 0 = 0
NativeUInt : 0 = 0
Int8       : 0 = 0
Int16      : 0 = 0
Int32      : 0 = 0
Int64      : 0 = 0
NativeInt  : 0 = 0
Single     :  0.000000000E+00 = none
Double     :  0.0000000000000000E+000 = none
Extended   :  0.00000000000000000000E+0000 = none
Currency   :  0.000000000000000000E+00 = none
TDateTime  :  0.0000000000000000E+000 = none
TGuid      : {00000000-0000-0000-0000-000000000000} = none
String     :  = none
Pointer    : nil = none

Types         Size - SizeOf : MinValue - MaxValue
-----------   ----------------------------------------------
Boolean    : 1 - 1 : should be 0 - 1 or false - true but currently not exist
Char       :  - 1 : no size should be #0 - #255 not exists
Byte       : 1 - 1 : 0 - 255
UInt8      : 1 - 1 : 0 - 255
UInt16     : 2 - 2 : 0 - 65535
UInt32     : 4 - 4 : 0 - 4294967295
UInt64     : 8 - 8 : 0 - 4294967295
NativeUInt : 8 - 8 : 0 - 4294967295
Int8       : 1 - 1 : -128 - 127
Int16      : 2 - 2 : -32768 - 32767
Int32      : 4 - 4 : -2147483648 - 2147483647
Int64      : 8 - 8 : -2147483648 - 2147483647
NativeInt  : 8 - 8 : -2147483648 - 2147483647
Single     : 4 - 4 : -3.402823466E+38 -  3.402823466E+38
Double     : 8 - 8 : -1.7976931348623157E+308 -  1.7976931348623157E+308
Extended   : 10 - 10 : -1.18973149535723176502E+4932 -  1.18973149535723176502E+4932
Currency   :  dont have helper yet but should be -922337203685477.5808 - 922337203685477.5807
TDateTime  :  no size no MinValue and MaxValue should be 0001-01-01 00:00:00.000 - 9999-12-31 23:59:59.999
TGuid      :  none
String     :  none
Pointer    : nil none


Code: Pascal  [Select][+][-]
  1. program TestHelper;
  2.  
  3. uses SysUtils;
  4.  
  5. var
  6.    VBoolean    :Boolean;
  7.    VChar       :Char;
  8.    VByte       :Byte;
  9.  
  10.    VUInt8      :UInt8;
  11.    VUInt16     :UInt16;
  12.    VUInt32     :UInt32;
  13.    VUInt64     :UInt64;
  14.    VNativeUInt :NativeUInt;
  15.  
  16.    VInt8       :Int8;
  17.    VInt16      :Int16;
  18.    VInt32      :Int32;
  19.    VInt64      :Int64;
  20.    VNativeInt  :NativeInt;
  21.  
  22.    VSingle     :Single;
  23.    VDouble     :Double;
  24.    VExtended   :Extended;
  25.  
  26.    VCurrency   :Currency;
  27.    VDateTime   :TDateTime;
  28.    VGuid       :TGuid;
  29.  
  30.    VString     :String;
  31.    VPointer    :Pointer;
  32.  
  33. begin
  34.    WriteLn( 'Types        Value Not Initialize = Ordinal Value' );
  35.    WriteLn( '-----------  ----------------------------------------------' );
  36.    WriteLn( 'Boolean    : ', VBoolean,       ' = ', Ord( VBoolean ), ' : ', true, ' = ', Ord( true ) );
  37.    WriteLn( 'Char       : ', VChar,          ' = ', Ord( VChar ) );
  38.    WriteLn( 'Byte       : ', VByte,          ' = ', Ord( VByte ) );
  39.    WriteLn( 'UInt8      : ', VUInt8,         ' = ', Ord( VUInt8 ) );
  40.    WriteLn( 'UInt16     : ', VUInt16,        ' = ', Ord( VUInt16 ) );
  41.    WriteLn( 'UInt32     : ', VUInt32,        ' = ', Ord( VUInt32 ) );
  42.    WriteLn( 'UInt64     : ', VUInt64,        ' = ', Ord( VUInt64 ) );
  43.    WriteLn( 'NativeUInt : ', VNativeUInt,    ' = ', Ord( VNativeUInt ) );
  44.    WriteLn( 'Int8       : ', VInt8,          ' = ', Ord( VInt8 ) );
  45.    WriteLn( 'Int16      : ', VInt16,         ' = ', Ord( VInt16 ) );
  46.    WriteLn( 'Int32      : ', VInt32,         ' = ', Ord( VInt32 ) );
  47.    WriteLn( 'Int64      : ', VInt64,         ' = ', Ord( VInt64) );
  48.    WriteLn( 'NativeInt  : ', VNativeInt,     ' = ', Ord( VNativeInt ) );
  49.    WriteLn( 'Single     : ', VSingle,        ' = none' );
  50.    WriteLn( 'Double     : ', VDouble,        ' = none' );
  51.    WriteLn( 'Extended   : ', VExtended,      ' = none' );
  52.    WriteLn( 'Currency   : ', VCurrency,      ' = none' );
  53.    WriteLn( 'TDateTime  : ', VDateTime,      ' = none' );
  54.    WriteLn( 'TGuid      : ', VGuid.ToString, ' = none' );
  55.    WriteLn( 'String     : ', VString,        ' = none' );
  56.    Write  ( 'Pointer    : ' );
  57.    if VPointer = nil then WriteLn( 'nil = none' );
  58.  
  59.    WriteLn;
  60.    WriteLn( 'Types         Size - SizeOf : MinValue - MaxValue');
  61.    WriteLn( '-----------   ----------------------------------------------' );
  62.    WriteLn( 'Boolean    : ', Boolean.Size,      ' - ', SizeOf( Boolean ),     ' : should be 0 - 1 or false - true but currently not exist' );
  63.    WriteLn( 'Char       : ',                    ' - ', SizeOf( Char ),        ' : no size should be #0 - #255 not exists' );
  64.    WriteLn( 'Byte       : ', Byte.Size,         ' - ', SizeOf( Byte ),        ' : ', Byte.MinValue,         ' - ', Byte.MaxValue );
  65.    WriteLn( 'UInt8      : ', UInt8.Size,        ' - ', SizeOf( UInt8 ),       ' : ', UInt8.MinValue,        ' - ', UInt8.MaxValue );
  66.    WriteLn( 'UInt16     : ', UInt16.Size,       ' - ', SizeOf( UInt16 ),      ' : ', UInt16.MinValue,       ' - ', UInt16.MaxValue );
  67.    WriteLn( 'UInt32     : ', UInt32.Size,       ' - ', SizeOf( UInt32 ),      ' : ', UInt32.MinValue,       ' - ', UInt32.MaxValue );
  68.    WriteLn( 'UInt64     : ', UInt64.Size,       ' - ', SizeOf( UInt64 ),      ' : ', UInt64.MinValue,       ' - ', UInt64.MaxValue );
  69.    WriteLn( 'NativeUInt : ', NativeUInt.Size,   ' - ', SizeOf( NativeUint ),  ' : ', NativeUInt.MinValue,   ' - ', NativeUInt.MaxValue );
  70.    WriteLn( 'Int8       : ', Int8.Size,         ' - ', SizeOf( Int8 ),        ' : ', Int8.MinValue,         ' - ', Int8.MaxValue );
  71.    WriteLn( 'Int16      : ', Int16.Size,        ' - ', SizeOf( Int16 ),       ' : ', Int16.MinValue,        ' - ', Int16.MaxValue );
  72.    WriteLn( 'Int32      : ', Int32.Size,        ' - ', SizeOf( Int32 ),       ' : ', Int32.MinValue,        ' - ', Int32.MaxValue );
  73.    WriteLn( 'Int64      : ', Int64.Size,        ' - ', SizeOf( Int64 ),       ' : ', Int64.MinValue,        ' - ', Int64.MaxValue );
  74.    WriteLn( 'NativeInt  : ', NativeInt.Size,    ' - ', SizeOf( NativeInt ),   ' : ', NativeInt.MinValue,    ' - ', NativeInt.MaxValue );
  75.    WriteLn( 'Single     : ', Single.Size,       ' - ', SizeOf( Single ),      ' : ', Single.MinValue,       ' - ', Single.MaxValue );
  76.    WriteLn( 'Double     : ', Double.Size,       ' - ', SizeOf( Double ),      ' : ', Double.MinValue,       ' - ', Double.MaxValue );
  77.    WriteLn( 'Extended   : ', Extended.Size,     ' - ', SizeOf( Extended ),    ' : ', Extended.MinValue,     ' - ', Extended.MaxValue );
  78.    WriteLn( 'Currency   : ', ' dont have helper yet but should be -922337203685477.5808 - 922337203685477.5807' );
  79.    WriteLn( 'TDateTime  : ', ' no size no MinValue and MaxValue should be 0001-01-01 00:00:00.000 - 9999-12-31 23:59:59.999' );
  80.    WriteLn( 'TGuid      : ', ' none ' );
  81.    WriteLn( 'String     : ', ' none' );
  82.    Write  ( 'Pointer    : ' );
  83.    if VPointer = nil then WriteLn( 'nil none' );
  84.  
  85.  
  86. end.
  87.  
  88.  

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Alias for Int64
« Reply #14 on: April 14, 2019, 07:44:04 am »
For completeness you should add a column with High(<type>); That gives the correct maxvaluess for e.g. uint64. If you agree you can file a bugreport if the maxvalue helper function is wrong.
Specialize a type, not a var.

 

TinyPortal © 2005-2018