Bestest non-bug yet! - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +--- Thread: Bestest non-bug yet! (/showthread.php?tid=2082) |
Bestest non-bug yet! - SMcNeill - 10-12-2023 Code: (Select All)
Note that the above is perfectly valid. In fact, Option _Explict won't even toss us an error saying "Undeclared Variable" here. It passes the IDE inspection, compiles just peachy fine, and is about the best example of "How NOT to Program" that I can think of. Why the heck does BASIC allow this type of junk to ever pass muster to even begin with?! And it that doesn't boggle your brain any, take a look at the extended version of this mess: Code: (Select All)
At no point did we declare a variable as x!, yet parameter x defaults to SINGLE, so Option Explicit happily accepts it as being declared as SINGLE, which makes x! valid -- except we can't reference it as X as X is now a local LONG, which is not to be confused with parameterX, which is SINGLE and can be referenced by x! but not x...... Confused yet?? RE: Bestest non-bug yet! - mnrvovrfc - 10-12-2023 It's too late to do anything about it and risk breaking a lot of programs. Especially those written by somebody who might still be modifying his stuff away from A, A!, A$, A&, A&& and many others... I'm not sure but this might be because the QB64 code processor creates a ridiculous internal C++ variable name, which starts with the variable name in BASIC code, and then the type such as "SINGLE" or "STRING" or an UDT. So there are no doubts at C++ code-mess level about which one is A and which one is A$, without caring if `OPTION _EXPLICIT` is going on. This is just an exerpt from random1's program modified by me to include some of Steve's code presented in another thread: Code: (Select All) *__DOUBLE_A=pow2(*__DOUBLE_A, 2 ); |