M
M
Marat Ganiev2020-04-17 18:12:59
C++ / C#
Marat Ganiev, 2020-04-17 18:12:59

What is the difference between #pragma once and include guards?

Is there a difference between:

#ifndef HEADER_H
#define HEADER_H

// code 

#endif

and this #pragma once

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2020-04-17
@MaratWantsToKnowALot

On the wiki they write that it is not a standard feature, although many modern compilers know it, but not all. So #ifndef is safer. #pragma once

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question