Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dependency tracking information to inline C++ blocks #5

Open
calebh opened this issue Sep 4, 2020 · 1 comment
Open

Add dependency tracking information to inline C++ blocks #5

calebh opened this issue Sep 4, 2020 · 1 comment

Comments

@calebh
Copy link
Owner

calebh commented Sep 4, 2020

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
Copy link
Owner Author

calebh commented Nov 26, 2023

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

calebh added a commit that referenced this issue Nov 30, 2023
…rn keyword, which is used as forward declaration. A global variable could still be used before being initialized, so this isn't a 100% fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant