bug-standards
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

column numbers and ranges in error messages


From: Per Bothner
Subject: column numbers and ranges in error messages
Date: Sun, 30 Sep 2018 16:06:07 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0

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.

Perhaps a sentence of the form:
  End positions are inclusive.  For example an unknown identifier 'abc' in the 
first 3 characters
  of the first line could be reported as:

  foo.c:1.1-3: unknown identifier 'abc'

(2) Is colon or period preferred as the separator between a line number and a 
column number?
The first mention of column numbers allows either. When talking about ranges 
(end positions),
only period is allowed.  The last example only uses colon.
--
        --Per Bothner
address@hidden   http://per.bothner.com/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]