Skip to content

ast_expression header file not included in other ast header files. #75

Answered by ymherklotz
mc1017 asked this question in Q&A
Discussion options

You must be logged in to vote

I do agree that it's not the best style, and I actually hadn't noticed until know. You are right that for the inheritance, it is actually necessary to have the full declaration of the class.

However, the reason it still compiles, is because you are only ever including ast.hpp everywhere else, which first includes ast_expression.hpp, and so all following header files will have Expression available. However, this does mean that if you just want to include ast_primitives.hpp on it's own in a separate file, you would get a compile error, because you would have to manually put #include "ast_expression.hpp before that, which isn't great. So it's definitely better to put #include "ast_expression…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mc1017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants