Giter Site home page Giter Site logo

Comments (10)

elfring avatar elfring commented on May 17, 2024 4

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

from sol2.

ThePhD avatar ThePhD commented on May 17, 2024 1

@nabijaczleweli is right: in this case, we want the inclusion to be exact and direct. If that's troubling to you, you can use the single header that's on the v2.0.0 release page.

from sol2.

nabijaczleweli avatar nabijaczleweli commented on May 17, 2024

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

Funny thing, this is exactly what's desired here!

from sol2.

elfring avatar elfring commented on May 17, 2024

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
…

from sol2.

Nava2 avatar Nava2 commented on May 17, 2024

@elfring What do you mean by "duplicated file search?"

Most (all?) implementations use " as search the cwd first, then the system directories. This is exactly what is wanted in this context. When the library is installed onto a system, it would be installed either via the single hpp file or it is still local and in the proper search path. If the library is found via -I and <> then it would still search the cwd first then the system directories. This is the right, and expected behaviour.

Unless I'm completely missing something.

from sol2.

sehe avatar sehe commented on May 17, 2024

@elfring If you want to discuss a detail about how includes work and what - in general - would be best to use in what circumstances, please do so on a discussion forum, or perhaps a Q&A site like http://stackoverflow.com. Right now you're saying "there are different opinions" but "therefore: you must change your opinion".

I have a feeling it's not gonna fly and it's not important. I haven't seen a single rational argument why <> would be better in this case. I'm genuinely confused why this issue hasn't been closed yet.¹

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

If the file is not found, then the wrong include style has been used for the file. Like the GCC docs linked state:

  • #include "file"
    

    This variant is used for header files of your own program.

There should not been "duplicate searching". Only if you use the wrong style /and/ the compiler implements the fallback search /and/ a name clash exists (which likely doesn't happen for #include "text/html/processing.hpp").


¹ apparently I missed it

from sol2.

elfring avatar elfring commented on May 17, 2024

If the file is not found, then the wrong include style has been used for the file.

Will "the angle brackets inclusion method" be usually triggered when you expect that the source file "sol/state.hpp" should be found in an installed system directory (instead of an other development folder)?

Only if you use the wrong style /and/ the compiler implements the fallback search

Do you know any compiler implementation which does not provide the specified "fallback"?

/and/

I find this interpretation interesting.

a name clash exists

Would you like to prevent this anyhow?

from sol2.

sehe avatar sehe commented on May 17, 2024

Will "the angle brackets inclusion method" be usually triggered when you expect that the source file "sol/state.hpp" should be found in an installed system directory (instead of an other development folder)?

@elfring this might be the essential point. I guess you could argue that public headers should use <> include style so it works best with usual -I, pkg-config, etc. approaches.

For internal includes, I'd say "" style is superior. It expresses intent. FWIW, I think the fallback is the only confusing factor here.

from sol2.

elfring avatar elfring commented on May 17, 2024

I guess you could argue that public headers should use <> include style so it works best with usual -I, pkg-config, etc. approaches.

I am trying to point this aspect out at various places.

from sol2.

ThePhD avatar ThePhD commented on May 17, 2024

This issue is ridiculous and you're clogging my e-mail.

If the inclusion style bugs you, download the header file from the release so you don't have to see the quoted includes.

from sol2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.