On Sunday, 22 September 2013 at 00:33:32 UTC, Walter Bright wrote:
On 9/21/2013 5:11 PM, Sean Kelly wrote:
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.
Holding the pointer has a cost of memory consumption and
compile speed :-) as well as having to have the source file
buffer stay around throughout the compile (to compute column
number you need the source in order to account for tabs &
Unicode).
Of course, we can cheat and use a byte to store the column
number, as after all, nobody has more than 256 columns.
[...]
That would do: 255 means column 256 or higher (256+). You would
please more than 99.99% of users :-)