Answer the question
In order to leave comments, you need to log in
Which directive is better to use for a class (#pragma once) or (#ifndef)?
Which directive is better to use for a class (#pragma once) or (#ifndef)?
Answer the question
In order to leave comments, you need to log in
I am for #pragma once
#ifndef a crutch invented instead of implementing a normal modular system, at least like the same Pascal, if we talk about bearded times.
And I use both options in header files. The outer one is pragma once, the inner one is ifndef. I already have auto-generation of these "brackets" posted on ifndef in geany. The fact is that not all compilers understand pragma once yet, for example, there were such problems with sdcc (I don’t know how it is now - I didn’t check it specifically).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question