### Sizes of Integer Types

Posted:

**19 Jan 2015 23:17**Hello Thomas, hi all,

I have run the below predicate
Old VIP build 7202 has output this:
In the above the only results, which I had not expected, are these of the last 3 lines. Is a variable of type

I tried it in current VIP build 7501 in 32 bit mode and it has output:
Why

Are all variables of type

(I really did it in 7501, even so constant

I checked it also in 64 bit mode of the current VIP build. Output shows same picture as before in 32 bit:
If the storage of integers in memory has changed between 7202 and 7501, please explain then changes!

Best regards

Martin

I have run the below predicate

**test**, which displays several byte sizes of integer types and variables, in different VIP builds.Code: Select all

```
class predicates
writeByteSize : (Type Var).
clauses
writeByteSize(Var) :-
stdIo::write("Bytesize of type variable is ", sizeOf(Var), "\n").
domains
rec8 = rec8(integer8).
rec16 = rec16(integer16).
rec32 = rec32(integer).
rec64 = rec64(integer64).
class predicates
test : ().
clauses
test() :-
stdIo::write("compiler version ", compiler_version, "\n"),
stdIo::write("platform bits ", platform_bits, "\n\n"),
hasDomain(integer8, I8),
I8 = 0,
stdIo::write("Bytesize of domain integer8 is ", sizeOfDomain(integer8), "\n"),
stdIo::write("Bytesize of variable I8 is ", sizeOf(I8), "\n"),
writeByteSize(I8),
stdIo::write("\n"),
hasDomain(integer16, I16),
I16 = 0,
stdIo::write("Bytesize of domain integer16 is ", sizeOfDomain(integer16), "\n"),
stdIo::write("Bytesize of variable I16 is ", sizeOf(I16), "\n"),
writeByteSize(I16),
stdIo::write("\n"),
hasDomain(integer, I32),
I32 = 0,
stdIo::write("Bytesize of domain integer is ", sizeOfDomain(integer), "\n"),
stdIo::write("Bytesize of variable I32 is ", sizeOf(I32), "\n"),
writeByteSize(I32),
stdIo::write("\n"),
hasDomain(integer64, I64),
I64 = 0,
stdIo::write("Bytesize of domain integer64 is ", sizeOfDomain(integer64), "\n"),
stdIo::write("Bytesize of variable I64 is ", sizeOf(I64), "\n"),
writeByteSize(I64),
stdIo::write("\n"),
hasDomain(rec8, Rec8),
Rec8 = rec8(0),
stdIo::write("Bytesize of domain rec8 is ", sizeOfDomain(rec8), "\n"),
stdIo::write("Bytesize of variable Rec8 is ", sizeOf(Rec8), "\n"),
writeByteSize(Rec8),
stdIo::write("\n"),
hasDomain(rec16, Rec16),
Rec16 = rec16(0),
stdIo::write("Bytesize of domain rec16 is ", sizeOfDomain(rec16), "\n"),
stdIo::write("Bytesize of variable Rec16 is ", sizeOf(Rec16), "\n"),
writeByteSize(Rec16),
stdIo::write("\n"),
hasDomain(rec32, Rec32),
Rec32 = rec32(0),
stdIo::write("Bytesize of domain rec32 is ", sizeOfDomain(rec32), "\n"),
stdIo::write("Bytesize of variable Rec32 is ", sizeOf(Rec32), "\n"),
writeByteSize(Rec32),
stdIo::write("\n"),
hasDomain(rec64, Rec64),
Rec64 = rec64(0),
stdIo::write("Bytesize of domain rec64 is ", sizeOfDomain(rec64), "\n"),
stdIo::write("Bytesize of variable Rec64 is ", sizeOf(Rec64), "\n"),
writeByteSize(Rec64),
stdIo::write("\n").
```

Code: Select all

```
compiler version 7202
platform bits 32
Bytesize of domain integer8 is 1
Bytesize of variable I8 is 1
Bytesize of type variable is 1
Bytesize of domain integer16 is 2
Bytesize of variable I16 is 2
Bytesize of type variable is 2
Bytesize of domain integer is 4
Bytesize of variable I32 is 4
Bytesize of type variable is 4
Bytesize of domain integer64 is 8
Bytesize of variable I64 is 8
Bytesize of type variable is 8
Bytesize of domain rec8 is 4
Bytesize of variable Rec8 is 4
Bytesize of type variable is 4
Bytesize of domain rec16 is 4
Bytesize of variable Rec16 is 4
Bytesize of type variable is 4
Bytesize of domain rec32 is 4
Bytesize of variable Rec32 is 4
Bytesize of type variable is 4
Bytesize of domain rec64 is 8
Bytesize of variable Rec64 is 8
Bytesize of type variable is 8
```

**rec64**not stored as a pointer (to a structure of 8 bytes)? On a 32 bit platform pointers have 4 bytes. But last 3 lines state 8 bytes.I tried it in current VIP build 7501 in 32 bit mode and it has output:

Code: Select all

```
compiler version 7500
platform bits 32
Bytesize of domain integer8 is 1
Bytesize of variable I8 is 4
Bytesize of type variable is 1
Bytesize of domain integer16 is 2
Bytesize of variable I16 is 4
Bytesize of type variable is 2
Bytesize of domain integer is 4
Bytesize of variable I32 is 4
Bytesize of type variable is 4
Bytesize of domain integer64 is 8
Bytesize of variable I64 is 8
Bytesize of type variable is 8
Bytesize of domain rec8 is 1
Bytesize of variable Rec8 is 1
Bytesize of type variable is 1
Bytesize of domain rec16 is 2
Bytesize of variable Rec16 is 2
Bytesize of type variable is 2
Bytesize of domain rec32 is 4
Bytesize of variable Rec32 is 4
Bytesize of type variable is 4
Bytesize of domain rec64 is 8
Bytesize of variable Rec64 is 8
Bytesize of type variable is 8
```

**sizeOf(I8)**and**sizeOf(I16)**yielding result**4**in build 7501?Are all variables of type

**rec8**to**rec64**not stored as pointers occupying 4 bytes in 32 bit mode?(I really did it in 7501, even so constant

**compiler_version**says 7500.)I checked it also in 64 bit mode of the current VIP build. Output shows same picture as before in 32 bit:

Code: Select all

```
compiler version 7500
platform bits 64
Bytesize of domain integer8 is 1
Bytesize of variable I8 is 4
Bytesize of type variable is 1
Bytesize of domain integer16 is 2
Bytesize of variable I16 is 4
Bytesize of type variable is 2
Bytesize of domain integer is 4
Bytesize of variable I32 is 4
Bytesize of type variable is 4
Bytesize of domain integer64 is 8
Bytesize of variable I64 is 8
Bytesize of type variable is 8
Bytesize of domain rec8 is 1
Bytesize of variable Rec8 is 1
Bytesize of type variable is 1
Bytesize of domain rec16 is 2
Bytesize of variable Rec16 is 2
Bytesize of type variable is 2
Bytesize of domain rec32 is 4
Bytesize of variable Rec32 is 4
Bytesize of type variable is 4
Bytesize of domain rec64 is 8
Bytesize of variable Rec64 is 8
Bytesize of type variable is 8
```

Best regards

Martin