emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using " rather than < for header files in Emacs


From: Mathieu Lirzin
Subject: Re: Using " rather than < for header files in Emacs
Date: Sat, 05 Mar 2016 14:09:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

"Herring, Davis" <address@hidden> writes:

>> I don't see why using " fixes anything. All these files have to compile
>> with -I anyway, because builders don't need to build Emacs in the source
>> directory.  We might actually be better off using '<' for all includes.
>
> Except for generated headers, most of these could be relative includes, which 
> is the usual meaning of #include"".

It will work for generated headers too.  Since '"' includes are a
superset of '<' includes as documented in GNU 'cpp' info manual.
However I don't know if this behavior is enforced by other c processors.

--8<---------------cut here---------------start------------->8---
Both user and system header files are included using the preprocessing
directive '#include'.  It has two variants:

'#include <FILE>'
     This variant is used for system header files.  It searches for a
     file named FILE in a standard list of system directories.  You can
     prepend directories to this list with the '-I' option (*note
     Invocation::).

'#include "FILE"'
     This variant is used for header files of your own program.  It
     searches for a file named FILE first in the directory containing
     the current file, then in the quote directories and then the same
     directories used for '<FILE>'.  You can prepend directories to the
     list of quote directories with the '-iquote' option.
--8<---------------cut here---------------end--------------->8---

I agree with Paul that this won't fix anything.  However I think keeping
using '"' includes have the semantic benefit of emphazing what headers
are part of Emacs which is helpful for people not familiar with the code
base.

In the case of config.h, using '"' could help emphasizing that is not a
system header but one can argue it could equally confuse people since it
is a generated file.  c-ctype.h is imported from Gnulib so should not be
considered part of Emacs so it would be better to keep using '<'.

-- 
Mathieu Lirzin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]