Collapse of whitespace by preprocessor

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kaleb Pederson

    Collapse of whitespace by preprocessor

    Hello,

    Does anybody know where in the standard it allows the preprocessed
    file to have whitespace removed/collapsed?

    I found the following in 16.1:

    "The source text is decomposed into preprocessing tokens and sequences
    of white space. A single white space replaces each comment."

    Is it the fact that it doesn't say that the sequences of whitespace
    between tokens must be preserved?

    Thanks.

    --Kaleb
  • Victor Bazarov

    #2
    Re: Collapse of whitespace by preprocessor

    Kaleb Pederson wrote:
    Does anybody know where in the standard it allows the preprocessed
    file to have whitespace removed/collapsed?
    It's implementation-defined. See [lex.phases]/3.
    I found the following in 16.1:
    >
    "The source text is decomposed into preprocessing tokens and sequences
    of white space. A single white space replaces each comment."
    >
    Is it the fact that it doesn't say that the sequences of whitespace
    between tokens must be preserved?
    Yes, it is the fact. The Standard does not require preserving the
    sequences of white-space characters.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask


    Comment

    • Kaleb Pederson

      #3
      Re: Collapse of whitespace by preprocessor

      On Feb 14, 6:50 am, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
      Kaleb Pederson wrote:
      Does anybody know where in the standard it allows the preprocessed
      file to have whitespace removed/collapsed?
      >
      It's implementation-defined. See [lex.phases]/3.
      Ahh, very nice. It's much more clearly defined there. For other
      interested parties, it reads:

      "Whether each nonempty sequence of whitespace characters other than
      new-line is retained or replaced by one space character is
      implementation defined."

      Thanks.

      --Kaleb

      Comment

      Working...