0

I want to know why each Cpp developer use ifndef in each file? and what's this functionality and what we will miss if we don't use that?

for example this is one class that I saw lastly:

#ifndef __LexerClassHeader__ #define __LexerClassHeader__ class LexerClass { //some code } #endif 
2
  • 4
    That’s an include guard. However, the particular code you’ve posted is invalid. Commented Aug 22, 2022 at 17:25
  • 3
    The one you are showing is a bad one by the way. Identifiers containing double underscores are reserved for the compiler and standard library implementation. You are not supposed to define them as macro or declare them in any other way. Use an identifier without double underscore and without underscore at the beginning. Commented Aug 22, 2022 at 17:27

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.