> #pragma once
Is there every a scenario where this is not needed in a header file?
Is there every a scenario where this is not needed in a header file?
#define VEC_TYPE double
#include <c-vector.h>
#undef VEC_TYPE
and that would provide you a type like "vec_double", a vector specialized for the double type. You'd want to import that once for each vector type you wanted.It's not the most common use-case (and you can argue if it's a good idea at all), but it is at least a reasonable reason why you'd want a header file without #pragma once.
Having said that, I almost did something like that recently, to initialise some generated data structures (include once for the structs and again to initialise memory pools), but I ended up finding a cleaner way that didn’t need it.