Comment in header file name?

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.

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:



This will compile
filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

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

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

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

This article is contributed by Pankaj Boola. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above



My Personal Notes arrow_drop_up


Article Tags :
Practice Tags :


1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.