Open In App

Comment in header file name?

Last Updated : 08 May, 2017
Improve
Improve
Like Article
Like
Save
Share
Report

What happens if there is a comment in header file name?
Parsing of `#include’ is slightly special because comments are not recognized within the ”. Thus, in `#include ‘ the `/*’ does not start a comment and the directive specifies inclusion of a system header file named `x/*y’. Of course, a header file with such a name is unlikely to exist on Unix, where shell wildcard features would make it hard to manipulate.

Below are some examples.




#include <stdio.h>
int main()
{
  printf("This will compile");
  return 0;
}


Output:

This will compile




#include <stdio.h/*comment*/>
int main()
{
  printf("This will not compile");
  return 0;
}


Output:

Error: stdio.h/*comment*/: No such file or directory




#include <std/*comment*/io.h>
int main()
{
  printf("This will not compile either");
  return 0;
}


Output:

Error: std/*comment*/io.h: No such file or directory


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads