0
Doubt regarding case sensitivity of #ifndef and #define used in the c++ course
#ifndef MYCLASS_H is used in header file of MyClass(), but C++ a case sensitive language?! How will it interpret this macro to be an instruction to include header?
5 odpowiedzi
+ 3
Yes.
The name C.h is the file name.
The header name, though, is Cc_H
Basically, they prevent including the header more than once.
Eg - you call cmath twice. This can make the program slow To prevent this, we use these guards which prevent defining the header more than once...
+ 2
Thats the naming by default.
You may change it to MyClass_H
The truth is that this define has nothing to do with the name.
The define is what makes your header readable.
Even if you have c.h,
You may have a include guard like this in it:
#ifndef Cc_h
#define Cc_h
#endif
For the compiler, it is Cc_h
But for you, it is c.h...
+ 2
Welcome ^_^
+ 1
Thank you. Okay so that means that once a header for particular class is included in main function then during execution these lines check if the header was included or should be included now(ifndef) and the name given just acts as an identifier?
+ 1
Thank you!