[Implemented] Signed Byte

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[Implemented] Signed Byte

Post by BackupUser »

Restored from previous forum. Originally posted by GPI.

Ok, that word and long are signed makes sence, but why are byte signed?

Normaly a Byte is used in the Rang from 0 to 255 and to from -127 to 128.

It would be nice to have a .ub -Type or, i think it is easier, a compiler-command like:

CompilerUseSignedByte
and
CompilerUseUnSignedByte

So the the programm can switch between the two possibilities.

for example:

Code: Select all

  CompilerUseUnSignedByte
  a.b=255
  debug a.b ; will return 255
  compilerUseSignedByte
  debug a.b ; will return -1
Also nice would be:

compilerUseUnsignedWord
compilerUseUnsignedLong

(but please don't switch all, .b.l.w at once. i only want to have a unsigned byte and signed words and long.)

Thanks.

PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by dmoc.

Why not .ub .uw and .ul? Maximum flexibility.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by THCM.

Yes, that would be cool! It took me some time till i found, that Bytes are signed! I peeked the Leveldata from my game and wanted to test if the byte is 255 and nothing happend.... silly of me!

Bye

The Human Code Machine / Masters' Design Group
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by GPI.

Btw: A good Solution

Code: Select all

a.b=240      ; this works fine
debug a.b    ; but this gives a negativ value
debug a.b$FF ; this not :)
a real .ub would be a better solution

PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
Post Reply