Page 1 of 1
CByte Parameter Type error
Posted: 22 June 2008, 3:29 AM
by Don_Kirby
Most likely related to the most recent compiler release (V2.5):
Passing a boolean value to CByte returns a compiler error.
Compiler wrote:Error: function "CByte", type conflict parameter 1, formal:Any Numeric, actual:Boolean
Code: Select all
Sub Main()
Dim X as Byte
X = CByte(True)
End Sub
The value of the boolean does not affect the outcome.
-Don
Posted: 22 June 2008, 6:53 AM
by mikep
According to the System Library reference
CByte does not accept a boolean value. Did this used to work or are you writing new code?
Posted: 22 June 2008, 8:53 AM
by Don_Kirby
According to the system library reference V2.2.2, Cbyte should accept a Boolean. It's the first type listed in the table of accepted types.
This is from old code. Only the error is new.
-Don
Posted: 22 June 2008, 9:40 AM
by dkinzer
Don_Kirby wrote:According to the system library reference V2.2.2, CByte should accept a Boolean.
You've discovered a hole in the test suite. It should have contained a test for that case (and for CBit and CNibble) which would have revealed the regression.
We've corrected the problem. The change is very localized, coming into play only for those three functions, so I'm making it available immediately for those who need it (
ZBasic v2.5.1). After the new version has been fully tested, it will be integrated into the installer.
Posted: 22 June 2008, 9:57 AM
by Don_Kirby
Thanks for such a quick solution Don.
-Don
Posted: 22 June 2008, 10:47 AM
by mikep
Don_Kirby wrote:According to the system library reference V2.2.2, Cbyte should accept a Boolean. It's the first type listed in the table of accepted types.
Sorry I was obviously half asleep this morning. My older hardcopy reference doesn't have it but the 2.2.2 manual does and so does the link I was pointing to