Sorry to "re-up" the subject but I was wondering if adding 
`getBegin()/getEnd()` is really a no-no?

  You said:
  > offset + length is easy to write; if we think we need end more often then 
length, we should add end and remove length

  But it's actually a bit longer to write:

    Foo.getOffset() + Foo.getLength()

  I'm writing some functions that checks if two ranges overlaps, are contained 
one within another, are in contact, ...And either the conditional looks a bit 
ugly or I end up creating a lot of 'range-end' variables like:

    unsigned RHSEnd = RHS.getOffset() + RHS.getLength();
    if (LHS.getOffset() > RHSEnd)
       ...

  IMHO `getEnd()`, and the `getBegin()` counterpart, wouldn't hurt readability.

  I don't see why it would be necessary to remove the offset/length if 
begin/end are introduced though.

http://llvm-reviews.chandlerc.com/D1156
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to