08-27-2022, 11:34 PM
(08-27-2022, 11:22 PM)TempodiBasic Wrote: @JRace
Thanks... it seems to me too dirty and not a straight C code!
a string is an array of chars both in C both in Pascal.
but this let me remember why I have more a theoretical than practical knowledge of it...
all these tricks that seem exceptions to the main rule, all possible but with no regard to clarity,
if you find and study them you can understand, otherwise you are in a nightmare... no logic and no syntax can help you.
char s;
s = "ABCD"[1];
printf (%c,s);
and
char s;
s = 'A';
printf (%c, s);
they do the same thing.
.... there are other deprecated ways about coding style like the use of Asset to control bounds range of variables and sprintf with int variables and so on.
I have some trouble to understand what the author was doing and why... so the translation will be only literal, I have no chances to write a good code in QB64 that does the same thing in a more manner of QB64.
There will be another path to reach the goal to manage MIDI files...
This is why I was asking how to use QB64's C compiler - so we can take weird lines of code like this, and run them in a test, to see exactly what they do.
Also, the code sort of works. I think if we break it down, the number of the weirder statements isn't so much.
And for the ASSERT, if those are defining out-of-bounds values, you merely check for those whenever the variable in question changes with IF/THEN statements.
At least that's how I would approach it...