-
Notifications
You must be signed in to change notification settings - Fork 234
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
Use of angle brackets around file names for include statements #10
Comments
We explicitly chose to use double quotes for internal includes, i.e., includes of one PEGTL header file from within another PEGTL header. That way we are independent of additional include paths and their order, thus more robust in some use cases. I am not aware of any problem or drawback caused by this. Do you have any problem with it? |
I suggest to reconsider the consequences of the following wording from the section "16.2 Source file inclusion" in the standard specification for the programming language "C++".
|
You are quoting 16.2/p3, but that kind of wording is also found in 16.2/p2 which therefore also applies to
(taken from N4140, emphasis mine) That said, it is defined quite well by all implementations I know of (and which are relevant to the PEGTL's minimum requirements). The "duplicate search" can not happen as the file referenced is our own and thus the first candidate. The last link you mentioned (from GCC) explicitly says:
And that is exactly what we are doing. |
There are different opinions about the handling of the involved implementation-defined behaviour.
|
Those points do not apply as the header we are referencing (in a relative way) is always found. Also, you would break the use-case where a user copies
And the PEGTL header would not even be able to use This is an important and from our side supported use-case which can only be achieved with double quotes. Your suggestion would break that use-case. It would not be any faster (as the files we are including with double quotes are always found) and there is no actual problem. I'm thus closing this issue. |
I suggest to think again about consequences from such an expectation. I would generally prefer to exclude the potential for the inclusion of header files from unexpected directories. Can such a security detail become a bit more important occasionally? |
Using double quotes is explicitly meant to exclude the "potential for the inclusion of header files from unexpected directories", thus preventing (security) issues. And we do not require the user to not include the path, it is just an option the user can chose if he/she wants to. |
Would you like to support the use case that your header files should occasionally only be found from the installed system directories? |
Yes, and it is currently supported by copying the PEGTL to a system include directory. We very purposefully and intentionally use double-quote includes inside the PEGTL. |
Your library can also be installed as it is usual with other software.
|
No, there is no potential for conflicts, and no, we never include from a "random or convenient" folder unless it is the folder in which the PEGTL itself resides and was chosen by the user, in which case it is by definition no longer "random". With quotes the search for include files starts relative to the file containing the include, so there are no problems. |
Would you like to replace any double quotes by angle brackets around file names for include statements?
The text was updated successfully, but these errors were encountered: