CByte Parameter Type error

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

CByte Parameter Type error

Post 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
mikep
Posts: 796
Joined: 24 September 2005, 15:54 PM

Post 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?
Mike Perks
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

Post 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
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post 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.
- Don Kinzer
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

Post by Don_Kirby »

Thanks for such a quick solution Don.


-Don
mikep
Posts: 796
Joined: 24 September 2005, 15:54 PM

Post 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 :oops:
Mike Perks
Post Reply