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 #440

Closed
elfring opened this issue Jul 26, 2018 · 15 comments
Closed

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

elfring opened this issue Jul 26, 2018 · 15 comments

Comments

@elfring
Copy link

elfring commented Jul 26, 2018

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

@hawicz
Copy link
Member

hawicz commented Jul 27, 2018

For #include "filename" the preprocessor searches first in the same directory as the file containing the directive, ...

and the files included by json.h are meant to be those which are locate in the same directory so, no, we will not replace those with angle brackets.

@hawicz hawicz closed this as completed Jul 27, 2018
@elfring
Copy link
Author

elfring commented Jul 27, 2018

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
…

@hawicz
Copy link
Member

hawicz commented Jul 27, 2018

You're not making any sense. How do you end up with a "duplicated file search" when the headers are in the same directory, and thus will be found immediately?
Why would we want to restrict the searched directories to just system directories when the files are, again, in the same directory ?

@elfring
Copy link
Author

elfring commented Jul 27, 2018

I suggest to take another look at the situation for an application programmer.
The required header files will be installed in a known directory.

  • Do you expect then that the desired header files are usually not found in the source directory which is used by the programmer?
  • Should headers be directly retrieved from a trusted include directory (without a lookup attempt from an other storage location)?

I prefer to avoid possible misunderstandings around the wording “the same directory”.

@ploxiln
Copy link
Contributor

ploxiln commented Jul 27, 2018

In this case, json.h contains #include "debug.h" so it will look in the same directory as json.h and it will find the correct file. The name "debug.h" is somewhat generic and at risk of also being used by a header from a different library or program, so doing #include <debug.h> would definitely be worse because it might find the wrong file, while #include "debug.h" will definitely find the correct file.

I think the ultimate answers to your pointed questions is that you will not be comfortable using libevent and should find an alternative.

@elfring
Copy link
Author

elfring commented Jul 27, 2018

The statement “#include <json-c/debug.h>” could be specified instead, couldn't it?

@hawicz
Copy link
Member

hawicz commented Jul 28, 2018

No, because that will pick up /usr/include/json-c/debug.h, even if I am attempting to compile against, for instance, a copy I've installed to /home/erh/json-c-current/ and it should be including /home/erh/json-c-current/include/json-c/debug.h.
Using angle brackets for these includes is just plain wrong.

@elfring
Copy link
Author

elfring commented Jul 28, 2018

  • How do you think about to reduce the probability for name clashes any further?
  • Would you like to adjust any build parameters for software applications?

@rgerhards
Copy link
Contributor

mmmhhh.. while @elfring is doing some nit-picking, the argument is not that weak. But @hawicz is also right in regard to developing json-c or having a special version on the system that is not installed into the default locations (but that could be handled via ./configure --prefix, --includedir, etc). It's primarily an issue for json-c developers themselves.

How about adding a configure switch (--enable-system-includes) which could selectively use one form or the other?

@hawicz
Copy link
Member

hawicz commented Jul 28, 2018

What argument? That we abandon a proven working method for ensuring the right header files are included, and instead switch to something that is dependent on getting the build parameters for anything that uses json-c just right? No thank you, not even as a configure switch, especially since that would be building some kind of terrible hack to generate the header files.

If there's a clash between the file names that json-c uses for it's headers and those located elsewhere, then feel free to do something like rename "debug.h" to "json_c_debug,h", but that's not at all what is being suggested in this bug report.

@elfring
Copy link
Author

elfring commented Jul 28, 2018

  • Build parameters are always involved, aren't they?
  • Where do you find a renaming acceptable?
    • File
    • Directory

@rgerhards
Copy link
Contributor

Just in case you were also curios. I did some background checks on elfring: it's highly probable a bot. Just one reference: https://twitter.com/johnregehr/status/718832080118005760 - also a look at the user profile might be helpful.

@elfring
Copy link
Author

elfring commented Jul 29, 2018

I suggest to recheck the available public development statistics.

@ploxiln
Copy link
Contributor

ploxiln commented Jul 29, 2018

Clearly not a bot, I think; just a very unusual individual.

@rgerhards
Copy link
Contributor

rgerhards commented Jul 29, 2018 via email

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

4 participants