Jose's Read Only Forum 2023

IT-Consultant: Charles Pegge => OxygenBasic => Topic started by: José Roca on September 09, 2013, 04:47:27 PM

Title: O2: int and integer
Post by: José Roca on September 09, 2013, 04:47:27 PM
Are they the same, ie. a short integer, or int is a long, like now in C++, and integer a short integer?

Do signed and unsigned apply to all numeric types? Are unsigned quads available or only signed ones?
Title: Re: O2: int and integer
Post by: Charles Pegge on September 09, 2013, 05:21:53 PM
int and integer are by default, 4 byte signed integers, same as long.

short is used to define 2 byte signed integers

But it is ialso possible to override int or integer, or any nother type definition, at any position or scope-block within the program:

typedef short int

Redefinition is a double edged sword to be used wisely :)

Unsigned integers word and dword are also available.

sys is a signed integer which should be used for all pointers, handles and generic integers. It is either 32 bits or 64 bits according to CPU mode.
Title: Re: O2: int and integer
Post by: Theo Gottwald on September 09, 2013, 09:55:53 PM
QuoteAre unsigned quads available or only signed ones?

Did you answer this, Charles?
I remember when i dissassembled PB that it looked to me that PB often used FP mnemonics on QUADS.
Title: Re: O2: int and integer
Post by: Charles Pegge on September 10, 2013, 05:29:28 AM
In a 64 bit binary, unsigned 64 bit integers (qwords) are supported, as well as quads.

In 32 bit mode, quads are passed to the FPU for processing, but qwords cannot be loaded in directly.

The general solution is to use the ext / extended type, which supports full 64 bit precision plus sign bit (plus 15 bit exponent)