logoalt Hacker News

tobyhinloopen12/09/20244 repliesview on HN

What's wrong with `#pragma once`? (honest question, i only do C and C++ as a hobby)


Replies

emsy12/09/2024

You can't target ancient compilers.

uecker12/09/2024

It is not supported everywhere and it uses some heuristic to determine that the file is actually the same one as used before, and this heuristic sometimes fails in complicated scenarios, e.g. with multiple shared directories, link, or because a file was copied.

Gibbon112/09/2024

Nothing is wrong with that.

show 1 reply
iainmerrick12/09/2024

Pedants don’t like it.