r/C_Programming • • 27d ago

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

84 Upvotes

58 comments sorted by

View all comments

1

u/EternalDoomSlayer 24d ago

I think the question has been answered, reading guards isn’t the biggest problem, however since we’re in C world, let’s not overcomplicate by having to interpret pragma.

C is such a damn good language (excuse my English) because you don’t have 25 different types of sugar! The above mention about pragma - is it supported or…. Where’s the quirk? This leads me to:

"Any problem in computer science can be solved with another level of indirection"

1

u/Conscious_Support176 23d ago

The technical term is abstraction. Abstraction just gets the computer to do work that otherwise we would have to do, which is kind of the point of programming in the first place?