In header files I've seen two main ways for defining macro to avoid including the file more than once.

1.

```
#ifndef SOME_CLASS
#define SOME_CLASS
//code ...
#endif

```

2.

```
#ifndef SOME_CLASS
//code...
#define SOME_CLASS
#endif

```

Which is more preferable and why?
['https://Stackoverflow.com/questions/6123544', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/509233/']
I prefer the first method, because it doesn't matter what happens after the ifndef because it will be defined straight after.
The first option is commonly optimized by compilers to behave like the non-standard `#pragma once`.

It is also safer in case of recursive includes. If, in the `//code...` part, you include another header which includes .... which includes the header you're currently editing, then the second version won't work.