PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs223] Line splicing
Date: Tuesday, 28 Jan 2020, 07:49:49


    > Message Posted By: Unknown
    >
    > In response to someone's question about line splices not nesting, you
    > provided this example:
    >
    >   sam\\
    >
    >   ple
    >
    > and said that Cxref should treat it like this
    >
    >   sam\
    >   ple
    >
    > by removing one backslash and a newline character but not removing the
    > other backslash and newline character since the other backslash wasn't
    > originally followed by the other newline character. If this is the case,
    > then there is only one newline character between "sam\" and "ple" and
    > Cxref's output should be:
    >
    >   sam:1
    >   ple:2
    >
    > However, when you pass this snippet in as standard input to the staff
    > solution, it outputs
    >
    >   sam:1
    >   ple:3
    >
    > Is this incorrect?

Yes.  Remember that Note 2 in the specification states:

  Thus for the convenience of the user (who would rather not have to simulate
  the C compiler when determining locations within a file), 
  should be the line number in the original file.

In the case above "ple" appears on Line 3 of the
original file, not on Line 2.

--Stan-
PREV INDEX NEXT