#ifdef = If whatever is defined then do this.
#ifndef = If whatever is NOT defined then do this.
#if = If this condition is met then do this.
#elif = Else if this condition is met do this.
#define = This really means that.
#undef = This no longer means anything.
There are a few more and you should read the link by moorecm but for the casually curious who don't want to read the article, and won't read it anyway, these are some poor summeries.
Sorry what you said confuses me a little. What is the difference then? I know not all compilers work with #pragma once. But don't they both inevitably do the same thing?
#pragma once: This tells the compiler that the header should only be processed once. the compiler keeps track of the header file name and if it comes across another #include for that header file it can move on without even opening the file.
#ifndef... (Include guard): The file is opened and processed. the guard is put in place. The next time the header file is included, the file is still opened, the guard is processed and the content is skipped until the corresponding #endif .
So, yes they inevitably do the same thing but #pragma once is supposed to do it quicker (reducing compile time). In a large project this can be significant.
Disclaimer:
I am not advocating the use of #pragma once but if you do use it it is better to use the 'standard' include guards as well.
I am also aware that some compilers are designed to recognise the 'standard' include guards and make every effort to increase there compile times acordingly.
I couldn't find anyone in this thread explaining why the heck one would want to use #if , so I'll just go and say it's useful for checking what something is defined as.