4 ms·
The compiler doesn't need to open the same file multiple times. It can remember if a a file is guarded or not every time it sees its name. My understanding is
by gpderetta 5mo ago
The compiler doesn't need to open the same file multiple times. It can remember if a a file is guarded or not every time it sees its name.
My understanding is that this is an optimization that has been available for a very long time now.
The only issue is if a file is referred through multiple names (because of hard links, symlinks, mounts). That might cause the file to be opened again, and can actually break pragma once.
- gpderetta 5mo agogcc actually documents this behaviour: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.htm...
- vanderZwan 5mo agoThank you for explaining and looking up the link, it's appreciated! :)