I was reading and came across the #pragma
directive, so I decided to do some research. However, I didn't understand much and would like to see if someone can shortly explain it to me about the #pragma
directive, because I don't understand the websites about it like cppreference, suggested by wohlstad, and I am just a beginner in C++. Thanks for any help!
(Edit: I saw a comment by Botje about what comes after #pragma
, but I just want to know all of its uses so that I can use it in the future.)
#pragma
...#pragma once
? Is an exact duplicate of a file, in a different location, "the same"? Is a file on a network, reached through a path that traverses different servers, easily recognizable a "the same"? There's no way to know, within the code you write, whether two#include
directives will satisfy#pragma once
; with include guards (correctly written, of course) you know exactly what you're getting.