No, but...
But I...
That's not...
Curses, they're onto me!
But I...
That's not...
Curses, they're onto me!
QB664PE v3.10.0 is now live for X-Mas!!
|
No, but...
But I... That's not... Curses, they're onto me!
12-23-2023, 02:33 PM
(12-23-2023, 12:52 AM)SMcNeill Wrote: Ha! You can *say* that, but we all know the real reason you're here! It's the same as everyone else's -- it's 'cause Steve is Awesome-and-Sexy, and the whole world has a crush on him and wants to be where he's at! Since I, the Awesome Steve, is here, logic only dictates that THAT is why you -- and everyone else -- wants to be here as well!!there's a grain of truth in your braggadocious statement a successful community and project ( QB64pe ) need an active leader
12-27-2023, 11:55 AM
Code: (Select All) Const CONST_BLUE = &HFF0000FF
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience
(12-27-2023, 01:19 PM)SMcNeill Wrote: It's implicit sign extension. If the highest bit in the hex variable is set, one should always EXPLICITLY tell the datatype by using type suffixes. The following works... Code: (Select All)
and this too... Code: (Select All)
by the way, 32-bit colors should be unsigned values anyways, it's explicitly mentiond in the wiki in several places regarding image/color usage. Wish people would just once look there befor complaining, its rather sucking to maintain the wiki and knowing nobody use it when needed.
GuiTools, Blankers & other Projects:
https://qb64phoenix.com/forum/forumdisplay.php?fid=32 Libraries & useful Functions: https://qb64phoenix.com/forum/forumdisplay.php?fid=23
12-27-2023, 01:37 PM
In this case, it doesn't appear to be CONST itself that's off, but something more internal, which we're just seeing via CONST here.
For hex values, CONST doesn't try to interpret the best value for us when calculating the number; it just assigns it to an _UNSIGNED _INTEGER64 -- which should hold the largest hex values that we push it, with no problems. The problem is, at that internal step, the value is now getting corrupted: Code: (Select All)
Quote:FFFFFFFFFFFFFFFF Those aren't the same two values at all!
12-27-2023, 04:32 PM
(12-27-2023, 01:35 PM)RhoSigma Wrote: It's implicit sign extension. If the highest bit in the hex variable is set, one should always EXPLICITLY tell the datatype by using type suffixes. The following works...You might be totally right, but it breaks 10 years of QB64 code that always accepted Code: (Select All) Const BLUE = &hFF0000FF
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience
12-27-2023, 05:04 PM
(12-27-2023, 04:32 PM)mdijkens Wrote:(12-27-2023, 01:35 PM)RhoSigma Wrote: It's implicit sign extension. If the highest bit in the hex variable is set, one should always EXPLICITLY tell the datatype by using type suffixes. The following works...You might be totally right, but it breaks 10 years of QB64 code that always accepted Oh, there's no problem accepting the Const BLUE = &HFF0000FF, it always did and will continue to do so, but it can't know what's in the programmers mind. Just by calling your const "BLUE", const can't know it shall be a color value which needs to be treated as unsigned number, for const it's still just some number, only the programmer knows what it is intended for and should code it that way. All that brings me once again back to RhoSigma's zero'th law of coding: If you want/need a certain state or behavior, than define it in your code as clear as possible using all capabilities available in the used programming language. Never depend or even worse assume any default behavior. Unfortunatly many coders do not, cause it offten includes a lot more keypresses, such as using type suffixes, declaring variables, using long unambigious variable names and so on.
GuiTools, Blankers & other Projects:
https://qb64phoenix.com/forum/forumdisplay.php?fid=32 Libraries & useful Functions: https://qb64phoenix.com/forum/forumdisplay.php?fid=23
12-27-2023, 06:00 PM
There's a glitch in there somewhere. It's not just an issue of type casting; it's tossing out incorrect values as it's evaluating incorrect input from the get go. Now WHY it's doing that is still a mystery at the moment, but we're digging into it.
12-27-2023, 10:29 PM
Hope this helps, directly assigned hex values under 16 bits are fine... but go over and it blows up. But the math still functions correctly when you go over 16 bits.
Code: (Select All)
|
« Next Oldest | Next Newest »
|