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

Use of angle brackets around file names for include statements #51

Open
elfring opened this issue May 13, 2016 · 20 comments
Open

Use of angle brackets around file names for include statements #51

elfring opened this issue May 13, 2016 · 20 comments
Assignees

Comments

@elfring
Copy link

elfring commented May 13, 2016

Would you like to replace any double quotes by angle brackets around file names for include statements?

@truell20 truell20 added the bug label May 13, 2016
@truell20 truell20 assigned truell20 and unassigned truell20 May 13, 2016
@truell20
Copy link
Member

@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?

@elfring
Copy link
Author

elfring commented May 14, 2016

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
…

@truell20
Copy link
Member

@FlyingGraysons @joshuagruenstein and I are a little unsure of what you are saying. Could you please clarify, @elfring?

@elfring
Copy link
Author

elfring commented May 15, 2016

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"?

@truell20
Copy link
Member

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.

@elfring
Copy link
Author

elfring commented May 17, 2016

Can you imagine use cases where you would like to exclude the search in "local" directories?

@truell20
Copy link
Member

I cannot

@truell20
Copy link
Member

@elfring Can you think of any use cases?

@elfring
Copy link
Author

elfring commented May 17, 2016

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?

@hmwildermuth
Copy link
Collaborator

@elfring What is the case?

@elfring
Copy link
Author

elfring commented May 17, 2016

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?

@truell20
Copy link
Member

What do you mean by this: "the desired computations were really correct"?

@elfring
Copy link
Author

elfring commented May 18, 2016

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?

@truell20
Copy link
Member

Yes, but the brackets mean that a person would have to specify an include directory, which is slightly annoying.

@elfring
Copy link
Author

elfring commented May 18, 2016

Will the mentioned "annoyance" vanish after safe include specifications would be used?

@truell20
Copy link
Member

Yes. This does sound like a good idea. Thank you for the feature request.

@truell20
Copy link
Member

Would specifying the include directory in our g++ compilation command in our makefiles and switching the the brackets fix your specified problem?

@elfring
Copy link
Author

elfring commented May 18, 2016

How would you like to distinguish library versions by your software build system?

@truell20
Copy link
Member

Not sure? Any suggestions?

@truell20
Copy link
Member

Feel free to submit a pull request that fixes the problem @elfring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants