Search found 7 matches

by joshklod
Tue Apr 21, 2020 2:42 pm
Forum: Software issues
Topic: ConBasic- Hello World
Replies: 11
Views: 25497

Re: ConBasic- Hello World

Hi all, I'm not sure I entirely understand this discussion, it's just barely over my head. That said, I would be very interested in a way to incorporate pieces of C code into a larger BASIC program. I can see two major benefits of this: Interfacing with C libraries supplied by vendors Gradually tran...
by joshklod
Mon Mar 16, 2020 2:59 pm
Forum: Software issues
Topic: Error on "Jump Around" Statements
Replies: 4
Views: 11923

Re: Error on "Jump Around" Statements

Thanks. The compiler now flags as an error, code that would not be executed Interestingly, the error is not thrown unless a sub/function is encountered before the statement, even when `MAIN` is used. Shouldn't it always be flagged as unreachable as long as there is a `MAIN`? A better fix is to remov...
by joshklod
Fri Mar 13, 2020 8:16 pm
Forum: Software issues
Topic: Error on "Jump Around" Statements
Replies: 4
Views: 11923

Error on "Jump Around" Statements

As of ARMbasic v9.47, the compiler sometimes throws errors on included library files. Specifically, whenever a `goto` is encountered after a subroutine, but before any labels, an "unreachable statement" error is thrown. Capture.PNG The following minimal example demonstrates this behavior: sub a ends...
by joshklod
Mon Aug 06, 2018 1:04 pm
Forum: Software issues
Topic: Macro/Literal Expressions
Replies: 4
Views: 7968

Re: Macro/Literal Expressions

Thank you for the info! To be clear (maybe my edit was confusing), my first example uses `#define`. Are parentheses required to trigger optimization in this case? It sounds like I can guarantee optimization as long as I wrap constant expressions (or sub-expressions) in parentheses. This is probably ...
by joshklod
Tue Jul 31, 2018 7:52 pm
Forum: Software issues
Topic: Macro/Literal Expressions
Replies: 4
Views: 7968

Macro/Literal Expressions

I often use macro expressions like the following in my code: #define LENGTH 16 if idx > LENGTH*3/4 then print "Almost full" I can see that the preprocessor correctly expands this to: if idx > 16*3/4 then print "Almost full" Is the Basic compiler smart enough to optimize`16*3/4` to `12`, or will the ...
by joshklod
Thu Mar 01, 2018 2:25 pm
Forum: Software issues
Topic: Printf Formatting Bug
Replies: 5
Views: 8839

Re: Printf Formatting Bug

The new firmware works perfectly. All my issues have been resolved.

Thank you very much for the fast fix!
by joshklod
Tue Feb 27, 2018 8:11 pm
Forum: Software issues
Topic: Printf Formatting Bug
Replies: 5
Views: 8839

Printf Formatting Bug

When using the `%f` specifier of `printf`, if the value is rounded up, the last trailing 0 is dropped. Tested with: ARMbasic[9.37m] BASICtools[6.06] ARMbasic Kernel[8.36a] SuperPRO Example: dim a as single a = -1 printf("%%1.4f: %1.4f %%1.2f: %1.2f %%1.1f: %1.1f", a, a, a) while a < 2 a += 1/256 pri...