#ifndef HEADER_H
vs
#pragma once
#ifndef HEADER_H
Hi there. The answer is #ifndef HEADER_H because it allows you to do the following.
#ifdef H_ONCE
#ifdef H_TWICE
#ifdef H_THRICE
#else
#define H_THRICE
class ObjectThree {
};
#endif
#else
#define H_TWICE
class ObjectTwo {
};
#endif
#else
#define H_ONCE
class ObjectOne {
};
#endif
This means that if I want to use ObjectTwo in my object, I will include this header twice.
#include "header.h"
#include "header.h"
And if I want to use ObjectThree, I will include the header 3 times while also getting access to ObjectOne and ObjectTwo.
Why? Because you want to take all of your class definitions and put them into one header. Then include that header a certain number of times depending on the combination of classes you need. This ensures job security.
I fucking hate guys like you.
Reminder to learn C and C# before touching C++, if at all
doesnt c++17 have a better answer to this?
>ISO vs common extension
hard to say, imho at this point #pragma once is acceptable in C++ world
I would still use include guards in C
so definitive answer: use whatever the guideline tells you to use
>shitty standard
>vs
>slightly better non-standard that is supported by everyone but Cray supercomputer compilers
>falling for 'C#' name
kek
Neither because it's useless.
Easily the pragma. If your compiler doesn't support it, it's shit.