Hacker News new | past | comments | ask | show | jobs | submit login

"The algorithm used by the vast majority of preprocessors is very simple: the preprocessor has a hardcoded list of directories, which the user can add to, and the preprocessor will scan them in sequence until it finds the file it's looking for. In the case of include "file.h", it will also scan the directory containing the source file."

At least for gcc, that is not quite correct. It also has a list of user directories.

The user list starts as a list containing only the current directory, but can be extended with command-line options. See https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: