Search code examples
c++directivepreprocessor-directive

Is 'using' keyword a preprocesor directive?


Is the using directive a preprocessor directive?

If not: Besides preprocessor and using directives, are there any other directives in C++?


Solution

  • Why do you think a keyword is a preprocessor directive? They are two substantially different things.

    To make it clear, a preprocessor directive always starts with a hash and must occupy at least a whole line. A keyword is instead a "word" (may contain underscores). So they have no commonness.

    Your answers:

    Is the directive using a preprocessor directive?

    No. It is a directive but not a preprocessor directive

    Is it handled by the preprocessor or the compiler?

    It's handled by the compiler, as a "directive" for name lookup.

    Also, what is a directive?

    You can safely believe whatever that doesn't compiles into actual, executable code is directive. This is a very broad question and a full answer won't fit here.

    You may want to look up "directive" in a dictionary.

    Is 'using' a directive or a keyword?

    Both.

    Am I right in understanding that All directives are not 'pre-processor directive' but all preprocessor directives are directives?

    Probably right. That makes sense.