Can someone explain me exactly what the below definition means in the C standard about directives

后端 未结 1 1897
梦毁少年i
梦毁少年i 2021-01-07 08:31

What i exactly need to know is what characters are allowed before the start of a directive as we all know we can have new line characters and whites

相关标签:
1条回答
  • 2021-01-07 09:02

    What this all basically means is that either # is at the start of a line or there is only whitespace before # on a given line.

    This part:

    either the first character in the source file (optionally after white space containing no new-line characters)

    Allows for whitespace before # if it's on the first line of the file, while this part:

    or that follows white space containing at least one new-line character.

    Allows for whitespace before # on any subsequent line.

    For example:

      #include <stdio.h>   // spaces before the first line
      #include <stdlib.h>  // spaces before another line, i.e, spaces and newline before a token
    int x;   #include <string.h> // not allowed, other tokens preceed on same line
    
    0 讨论(0)
提交回复
热议问题