help-bison
[Top][All Lists]
Advanced

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

Re: Further C++ operators for position


From: Christian Schoenebeck
Subject: Re: Further C++ operators for position
Date: Mon, 04 Nov 2019 12:04:07 +0100

On Montag, 4. November 2019 07:52:05 CET Akim Demaille wrote:
> But what should you do when the files are different?  (And Locations are
> intervals, so there's no way to compare them totally in a natural order.)
> 
> What we can do, though, is offer implementations for std::less, that would
> blindly apply the lexicographic order in both cases.
> 
> But the case of file names remains troublesome: should we compare the
> pointer addresses (super fast, but non deterministic) or the pointees
> (super slow, but deterministic)?

Or neither one of them? Think of relative pathes vs. absolute pathes (for the 
same file that is), symlinks, hard links, etc. Do you really want to open that 
door? :-) Some of those issues could be handled by checking inode numbers and 
device IDs instead of looking at the path string, which however can fail as 
well though with certain virtualized file systems or remote file systems.

Plus, this C++ class is limited to "points". I don't know your use case, but 
often you'll realize later on that handling locations as points is too 
primitive for many use cases. I'd recommend to track locations always as spans 
(first_line, first_column, last_line, last_column).

Best regards,
Christian Schoenebeck





reply via email to

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