Use of angle brackets around file names for include statements
elfring opened this issue · 20 comments
Would you like to replace any double quotes by angle brackets around file names for include statements?
@elfring Doesn't that mean that the library would have to be globally installed for it to build and run properly? Or would the include
folder have to be marked as an include path by g++? Either way, what is the advantage over the double quotes?
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++".
…
The named source file is searched for in an implementation-defined manner. If this search is not supported, or if the search fails, the directive is reprocessed as if it read
#include <h-char-sequence> new-line
…
- How do you think about to avoid "a duplicated file search" here?
- Would you like to restrict the searched directories for header files of your software?
@FlyingGraysons @joshuagruenstein and I are a little unsure of what you are saying. Could you please clarify, @elfring?
There are different opinions about the handling of the involved implementation-defined behaviour.
- Will header files be also searched outside the specified include directories if double quotes are used for the discussed preprocessor statement?
- Is there a speed difference measurable if a file is not found there and the search will be retried with "the angle brackets inclusion method"?
I believe that:
- If double quotes are used, only the local and include directories are searched
- If brackets are used, the system and include directories are search are search
I doubt that there is a measurable speed difference between the two methods.
I may be wrong though.
Can you imagine use cases where you would like to exclude the search in "local" directories?
I cannot
Yes. - This is the reason for my feature request here.
How much do you care where the include files are safely stored for a software library?
@elfring What is the case?
I find it important to be reasonably sure that the desired computations were really correct because it could be determined by the applied software build parameters that the used functions were actually derived from the expected source files. Can you follow this design concern?
What do you mean by this: "the desired computations were really correct"?
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?
Yes, but the brackets mean that a person would have to specify an include directory, which is slightly annoying.
Will the mentioned "annoyance" vanish after safe include specifications would be used?
Yes. This does sound like a good idea. Thank you for the feature request.
Would specifying the include directory in our g++ compilation command in our makefiles and switching the the brackets fix your specified problem?
How would you like to distinguish library versions by your software build system?
Not sure? Any suggestions?