On Sep 21, 2013, at 12:47 PM, Walter Bright <newshou...@digitalmars.com> wrote:

> On 9/21/2013 12:38 PM, eles wrote:
>> On Saturday, 21 September 2013 at 18:55:46 UTC, Walter Bright wrote:
>>> On 9/21/2013 11:03 AM, Maxim Fomin wrote:
>>> 
>>> test.c:4: error: overflow in enumeration values
>> 
>> It would be difficult to make the front-end track also the column number 
>> where
>> it encountered (estimated) the error?
> 
> That's gcc, and 4 is the line number (and the wrong line number) of the 
> error. No column number.
> 
>> This will make error messages a bit more clear (and in the line of thos in 
>> gcc),
>> especially for long code lines (where you could have, for example, several
>> instructions on the line).
>> 
>> At the beginning, until the feature is really implemented, the front-end 
>> could
>> always provide "column=1", ie stick with current approach.
>> 
>> But this will help the gdc/ldc-implementations to be in line with the 
>> messages
>> provided by gcc and clang.
> 
> Tracking the column number is certainly doable, but it comes at a cost of 
> memory consumption and some compile speed, since it has to be tracked in 
> every token. I used to do it in the Digital Mars C compiler, but it was of 
> only marginal utility and I dropped it.

Can't you just hold a pointer to the beginning of the line and subtract to find 
the column?  I agree that it's generally of marginal utility though. 

Reply via email to