Forum > FPC development

"un"def Types

<< < (2/2)

Thaddy:

--- Quote from: circular on January 14, 2023, 08:19:42 am ---You could redefine the type so that it cannot be used.

--- End quote ---
Yes, anywhere BUT the system unit!
Everything for which the compiler inserts code is in system.fpd. None of that can be controlled by you unless you rewrite the compiler. Examine rtl\inc\system.fpd for what you can't do yourself.
Note changing the fpd file does not help, it is documentation only. See the header:'This File contains extra, phony declarations used in fpdoc"

Btw, it is still not clear to me how OP wants to redefine the smallint type. There may be other ways to introduce a type with a different range.

The best thing I could come up with is ranges by significant bits in power of two's:
ranges:
2              range  Boolean;
4              range -2..1
8              range -4..3
16            range -8..7
32            range -16..15
64            range -32..31
128          range -64..63
256          range  shortint
512          range -256..255
1024        range -512..511
2048        range -1024..1023
4096        range -2048..2047
8192        range -4096..4095
16384      range -8096..8095
32768      range -16384..16383   
65536      range SmallInt

Well, if I am right, invent some names for the types and write a full set of operators for them....
Like I did for ternary values -1..1.

VisualLab:

--- Quote from: Thaddy on January 14, 2023, 09:28:24 am ---Like I did for ternary values -1..1.

--- End quote ---

Did it have to do with the TValueSign type?

Navigation

[0] Message Index

[*] Previous page

Go to full version