For WinFBE users

Windows specific questions.
Munair
Posts: 1286
Joined: Oct 19, 2017 15:00
Location: Netherlands
Contact:

Re: For WinFBE users

Post by Munair »

deltarho[1859] wrote: Feb 23, 2022 5:42 In fact, we get this warning with CBool(10).
Indeed, when converting a variable, it's ok.

Code: Select all

dim a as integer = 10
print cbool(a)
So the problem seems to be the constant value. Interesting.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: For WinFBE users

Post by fxm »

fxm wrote: Feb 23, 2022 6:41 The definition under the hood of a Boolean is an 1-bit integer.
So a conversion overflow warning is applied as for any other numeric datatype (Byte, Short, ...) only at compile time (only for a literal value).
Munair
Posts: 1286
Joined: Oct 19, 2017 15:00
Location: Netherlands
Contact:

Re: For WinFBE users

Post by Munair »

fxm wrote: Feb 23, 2022 6:55 So a conversion overflow warning is applied as for any other numeric datatype (Byte, Short, ...) only at compile time (only for a literal value).
So why does dim a as byte = 10: print cbool(a) not give a conversion warning? It would seem more appropriate here with an explicit data type than with a numerical constant (intentionally) without explicit datatype. The warning is hard to understand, especially for beginners and doesn't really serve a practical purpose IMO.
Munair
Posts: 1286
Joined: Oct 19, 2017 15:00
Location: Netherlands
Contact:

Re: For WinFBE users

Post by Munair »

To avoid double posts, see the conversation here: viewtopic.php?p=290178#p290178
Post Reply