3 ms·
>The pragma once solution works, but it is hard to implement it for every system (what happens when a file has different names but same content)? I would say,
by john_moscow 6y ago
>The pragma once solution works, but it is hard to implement it for every system (what happens when a file has different names but same content)?
I would say, that qualifies as "good enough". The amount of headache saved from accidentally having 2 guards with the same name it way more than the requirement to NOT have multiple symbolic paths to the same file used at the same time.
That said, modern compilers just use inode number (and a similar thing on Windows), that covers about 99.9% of real-world systems where you want to build.