Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A possible bug in qb64
#1
I am trying to use lower case i, j, and k as counters for looping. To declare them I'm using this:

_define i-k as _unsigned integer

But as soon as I go to the next line, the letters i to k turn uppercase and therefore the lower case i, j, and k which are used in looping get error message that they are not declared.

I tried to use lcase$() to keep the letters in lowercase, but get error message for _define statement.

Any idea why it doesn't work?
Reply
#2
If you're using Option _Explicit, a _DEFINE isn't enough to declare a variable -- they have to be expressly dmmed as whatever type you wish them to be.

Change that line to the following instead:

DIM AS _UNSIGNED INTEGER I, J, K

Note 2 that QBASIC and QB64 are neither one CaSe SeNsItIve...
  
I or i, it doesn't matter as far as variable names go.   The IDE just happens to choose uppercase or lowercase to match whatever format you apply first in your code for asthetic reasons.  As for storing values or executing code?  There's no difference at all between Foo, FOo, FOO, fOO, foO, or any other mixture of upper/lowercase version of FOO.  Wink
Reply
#3
(03-22-2024, 04:47 AM)SMcNeill Wrote: Note 2 that QBASIC and QB64 are neither one CaSe SeNsItIve...
  
I or i, it doesn't matter as far as variable names go.  
Which is how ALL programming languages should have been, in the first place.

I mean, when I first discovered the C language, and I discovered a number of syntactic features that I thought were fantastic, like:
* The ++ (or --) operator, increment (or decrement) the variable next to it so that you can use
     i++ or ++i to increment, and --i or i-- to decrement, the variable i by 1, a very common practice in programming. Plus, it goes further than that, so that you can say
     k==++i , which means, add 1 to i and assign it to k, or
     k==i++, which means, assign the current value of i to k, then add 1 to i. The symbol -- does the same thing, except it subtracts 1.
* The +=, -=, *=, and /= operators. This allows compressing an expression
   k == k*5 can be expressed as
  k*=5
This also works for the other three operators.
This last feature is so useful that Free Pascal has implemented +=, -=, *=, and /= as an addition to the standard
  A := A+31; which can now also be expressed as  a+= 31;

However, one of the things that soured me on the language was the brain-dead, stupidly moronic, and insane practice of having CASE-SENSITIVE identifiers! Programming is hard enough as it is, and making identifiers case-sensitive is the stupidest way to cause programmers to introduce bugs. Now, on top of the effort of getting the scope and "seeing the picture" of a program, so you can maintain it, now you have to remember which case the identifier uses. Yes, I know by now C/C++ programmers have gotten used to this state of affairs, but, then again, we have a phrase for those trapped in a situation and think it is reasonable, "The Stockholm Syndrome."
While 1
   Fix Bugs
   report all bugs fixed
   receive bug report
end while
Reply




Users browsing this thread: 1 Guest(s)