bmx-ng / bcc

A next-generation bcc parser for BlitzMax
zlib License
33 stars 12 forks source link

False/True handled as integer - for what reason? #679

Open GWRon opened 5 days ago

GWRon commented 5 days ago

Take this code:

SuperStrict
Framework Brl.StandardIO

Function TakeByte:Int(a:Byte)
End Function

TakeByte(False)

it results in: Compile Warning: In call to Function TakeByte:Int(a:Byte). Argument #1 is "Int" but declaration is "Byte".

Is there a reason for "True/False" being internally integers? I know we do not have real booleans for now - but if we consider True is "1" and False is "0" (check with print (5 * true) and print (5 * false)) then couldn't we use the lowest possible primitive we support? In this case: Byte?

GWRon commented 5 days ago

BTW: when not passing False, but the comparison False=False (yeah..True!), it does not raise an error/warning:

TakeByte(False=False)