Juniper icon indicating copy to clipboard operation
Juniper copied to clipboard

Add dependency tracking information to inline C++ blocks

Open calebh opened this issue 4 years ago • 1 comments

We currently cannot track what variables a C++ block uses, leading to potential ordering problems when generating output C++. For example, a inline C++ in a function may refer to a global variable stored in a module, but the Juniper compiler may place that global variable declaration after the function declaration. This is only an issue for global variables, which cannot be forward declared. Alternatively, try to use smarter heuristics like maintaining the order of global variable declarations based on position in the source code. At the very least, we can move all global variable declarations to come before function declarations.

calebh avatar Sep 04 '20 02:09 calebh

This could be solved by using the extern keyword to forward declare the global variables.

calebh avatar Nov 26 '23 22:11 calebh