r/C_Programming • • 20d ago

Could someone explain the practical differences between #pragma once and traditional include guards (#ifndef, #define, and #endif)?

81 Upvotes

58 comments sorted by

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.