
I just want basic to wait until the contents of a memory location are zero!
Code: Select all
99 REPEAT:UNTIL 0=?F%
Code: Select all
Syntax error at line 99
Code: Select all
99 REPEAT:UNTIL 0=?F%
Code: Select all
Syntax error at line 99
Code: Select all
99 REPEAT:UNTIL 0=?&F%
I'm beginning to think that the statement in bold is not true!
Big sentence wins....!I wrote:If you are messing with system memory and/or devices therein and if your F% location does take a finite time to become zero such that the Basic program is largely looping at line 99, then a misguided interrupt-driven poke or illegal action that erroneously disrupts Basic’s operating framework could quite plausibly cause Basic to bomb-out and in which case, the error message is likely to be somewhat arbitrary though correctly reporting the correct current line number.
While it is semantically identical, it make more sense to the reader as:
Code: Select all
99 REPEAT:UNTIL ?F%=0
Code: Select all
$ bbcbasic
PDP11 BBC BASIC IV Version 0.32
(C) Copyright J.G.Harston 1989,2005-2020
>_
Code: Select all
if (foo = 1) {
Code: Select all
if (foo == 1) {
Code: Select all
if (1 = foo) {
Code: Select all
for (i = 0; i < 10; i++) {
julie_m wrote: ↑Wed Oct 07, 2020 2:55 pmMind, another common idiom in C-derived languages is writingas though you cared what the value of i was immediately before it had one added to it .....Code: Select all
for (i = 0; i < 10; i++) {
Both are valid in C - is that not also true in C++?
I had a feeling it may be something like this. It was probably this kind of thing that would have lead to Linus's rant against C++. In this case one can easily avoid it by using ++i but it does seem there is a problem with the language design here. Ideally the compiler should not be considering post increment to be equivalent to copy and then increment the original but an completely separate operator. If you have not overridden that operator on the class of i when writing i++ then it should simply refuse to compile your code.tricky wrote: ↑Tue Oct 13, 2020 3:58 pmPre and post are both valid in both C and C++.
In C on nearly all processors, there is no performance difference to either.
In C++ you can override operator ++() or operator ++(int). The int is unused, it just means the i++ version!!!!!
i++ means copy i, then increment it and use the new old value. In C++ copy i could involve lots of work and the copy may not always be optimised away. There have been many changes to C++, partially to reduce the occasions when the copy is required, but I believe that there are still some! i could be a database backup system!