On 9/30/18 4:06 PM, Per Bothner wrote:
Two related issues about section "4.4 Formatting Error Messages"
(https://www.gnu.org/prep/standards/html_node/Errors.html):

(1) "The error message can also give both the starting and ending positions of the 
erroneous text."

This is ambiguous wrt respect to whether end positions are exclusive or 
inclusive.
In most APIs I'm familiar that talk about ranges (such as a substring function), an 
"end position"
is exclusive (but is zero-based).  However, it seems clear to me that we want 
*inclusive* ranges;
one reason is that otherwise you would never have a duplicate line numbers.

I think I'm wrong here: Exclusive end positions are ok.  (I was thinking in 
terms
of a line range being delimited by an exclusive end line number, but that is 
not relevant.)

I haven't found real examples of code that emits

   sourcefile:line1.column1-line2.column2: message
or
   sourcefile:line1:column1-line2:column2: message

However, gcc's and clang's -fdiagnostics-parseable-fixits (and clang's 
-fdiagnostics-print-source-range-info)
options emit sources ranges with exclusive end-points.  However, the ranges are 
meant to be
machine-parsable, are inside braces, and count bytes rather than characters, so 
may not be
directly relevant.
--
        --Per Bothner
p...@bothner.com   http://per.bothner.com/

Reply via email to