QM free attribute code generation problem
Real-Time Event Frameworks based on active objects & state machines
Brought to you by:
quantum-leaps
Hello,
I've just noticed an issue in QM (v 7.0.1) for C++ when I added a free attribute into a package and set the visibility to "file".
In this case when generating code the $declare {$package} command generates code with the extern qualifier, while the $define ${package} makes it static.
This causes the compiler to throw an error as expected.
It seems like a bug to me, or am I maybe missing something?
Anonymous
Here is an interesting question: How do you declare, but NOT define, a variable in file scope?
AFIK, there is no way to do this in C or C++. Consequently, what is QM to do when you ask it to do just that?
The only workaround for this that I see at this moment is NOT to do this to QM. If you have a file-scope variable, put it into the file directly (as
static Foo attr;):--MMS
Last edit: Quantum Leaps 2025-04-14