[Top][All Lists]

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

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

From: Paul Eggert
Subject: Re: Using " rather than < for header files in Emacs
Date: Sat, 5 Mar 2016 09:39:01 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

Herring, Davis wrote:
It is defined by C (don't know as of which version off hand) that #include"x" can 
find what #include<x> finds (but may find something else first).

Yes, a portable program can't assume that "..." will find files that <...> won't. In some C compilers, "..." looks in the working directory that the compiler is run in; in POSIX-compatible compilers (including GCC) "..." will first look in the directory containing the source file that has the "..."; in other C compilers (including Microsoft) "..." will also search in the directories of currently opened include files; and I assume there are other possibilities.

In theory, the "..." form could lead to including the wrong file. In practice, the way Emacs does it is harmless, but why add risk by using "..." more often?

(There was a reason in GCC before 3.0 to prefer angle brackets or double quotes, depending on whether you wanted -MM to generate dependency information, but that reason is obsolescent now.)

reply via email to

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