Comments (8)
#include with double quotes are used intentionally when we are including a file from the same directory or a path relative to it. This is the case for the example you linked.
If you find a case where there is an double-quote #include and file is included from the include path, please do send a pull request.
from bond.
I assumed that the referenced header file belongs to your public application programming interface, doesn't it?
from bond.
Yes. When you include it in your program you should include it as following (that's what the examples do):
#include <bond/core/apply.h>
But when we include it from another header in bond/core
we use #include "apply.h"
. In part that is a convention but this is also the most unambiguous way to include it: #include <bond/core/apply.h>
could be "hijacked" by the user of Bond, either by accident or on purpose, by putting another file with that name in front of include path.
from bond.
It seems that I do not really understand the purpose for your kind of distinction around such API header usage so far.
from bond.
The distinction is not based on whether header is API or not but where it should be included from: the same directory or include path.
What advantage do you see in looking for such headers in the include path first? Either preprocessor will find the file in the same directory (which is what #include with quotes will always do) or it will find another file, in which case it will be wrong.
from bond.
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?
from bond.
I'm going to close the issue as won't fix and I think we are over-analyzing it. Both conventions are plausible and different libraries use them. But since you are quoting the standard I want to point out that the standard actually has even more hardcore recommendation against using the < > form than the convention we adopted. The standard recommends that the < > form should be used only for header files provided by the implementation (i.e. the standard library), see the note 7 in section 16.2 Source file inclusion
of C++11 standard:
[Note: Although an implementation may provide a mechanism for making arbitrary source files
available to the < > search, in general programmers should use the < > form for headers provided
with the implementa-tion, and the " " form for sources outside the control of the implementation.
For instance:
#include <stdio.h>
#include <unistd.h>
#include "usefullib.h"
#include "myprog.h"
—end note]
from bond.
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 bond.
Related Issues (20)
- In C# implementation, how to parse to structs separated by BT_STOP_BASE HOT 2
- Correct way to read list of mapped values in C# HOT 3
- [ci] Image cleanup script needs to handle 18.04 images
- [ci] CI image Dockerfile needs to be paramatarized on FROM registry
- This repo is missing important files
- c#: Add ToString() implementations for compiled bond objects HOT 1
- Merge API support for C#? HOT 2
- Bond generated headers don't work for clang in c++20 HOT 2
- Include enums in Bond runtime schema HOT 1
- cmake/Config.cmake looks for the EOLed Python-2.7 HOT 1
- Deserialization/serialization under Linux is 7x-10x slower than Windows HOT 2
- [C#] gbc.exe: Exec format error inside mcr.microsoft.com/dotnet/sdk:latest docker image. HOT 3
- "openFile: does not exist (No such file or directory)" on Linux HOT 3
- [C#] Deserializing bond-like strings into dynamic type HOT 2
- Linux build error - ghc: panic! HOT 4
- Support dotnet trimming HOT 5
- Target `netstandard2.0` for c# HOT 1
- C++: GCC: Double/Float comparison warning HOT 2
- Is this project still being maintained? HOT 2
- emit #nullable enable pragma in generated C# code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bond.