r/C_Programming • u/Yuki_pop • 20d ago
Could someone explain the practical differences between #pragma once and traditional include guards (#ifndef, #define, and #endif)?
81
Upvotes
r/C_Programming • u/Yuki_pop • 20d ago
View all comments
0
u/kolorcuk 20d ago
Esphome copies header files when compiling. Effectively after moving a file with pragma once i have duplicate symbols errors.
Except for that no difference. All modern compilers have pragma once. If you don't plan supporting odd compilers, use pragma once.