> On Nov 7, 2016, at 8:43 AM, Christopher Collins <[email protected]> wrote: > > On Mon, Nov 07, 2016 at 08:08:14AM -0800, marko kiiskila wrote: >> Good idea to write this down. >> >> I’d also like to include header files from other packages to be in the >> group included with angle brackets. >> Then “header.h” means local and <header.h> is for non-local. > > Is there a particular reason that you would prefer this? By my reading > of the standard, using angled-brackets for this purpose contradicts > their specified purpose, at least in spirit.
Familiarity of practice, I guess. http://lxr.free-electrons.com/source/kernel/sched/core.c <http://lxr.free-electrons.com/source/kernel/sched/core.c> https://www.freebsd.org/cgi/man.cgi?query=style&sektion=9 <https://www.freebsd.org/cgi/man.cgi?query=style&sektion=9> However, I’m not too tied to this, if you have a very strong preference. > This is from n1570 (free draft of the 2011 standard, available at > http://www.iso-9899.info/n1570.html): > > (6.10.2) > 2 A preprocessing directive of the form > # include <h-char-sequence> new-line > searches a sequence of implementation-defined places for a header > identified uniquely by the specified sequence between the < and > > delimiters, and causes the replacement of that directive by the > entire contents of the header. How the places are specified or the > header identified is implementation-defined. > > 3 A preprocessing directive of the form > # include "q-char-sequence" new-line > causes the replacement of that directive by the entire contents of > the source file identified by the specified sequence between the " > delimiters. 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 > with the identical contained sequence (including > characters, if > any) from the original directive. > > The relevant difference among these paragraphs is "header" vs. "source > file." When you use angle-brackets, the compiler includes > implementation-specific source. This is usually a plain C file, but it > could also be some sort of precompiled header or dynamically generated > magic. With double quotes, a file always gets included. Since we don't > control the implementation (and in fact expect Mynewt to build with > several different implementations), it would seem that we should only > use angled-brackets for implementation-supplied files. > > Chris
