On Tuesday, 17 de May de 2011 12:38:53 Stephen Bryant wrote:
> > I agree there, though there are things to considder. Like, what would
> > you
> > return from a method like QList::indexOf()?
> 
> Ummm..  std::out_of_range?

That would be an exception, which we've already agreed we're not going to do. 
And it would be source-incompatible, which is against the goals of Qt 5.

Breaking source compatibility must be done for good reasons. And doing it in 
the container classes must be LAST RESORT. There's just too much code using 
them and changing compatibility there would introduce subtle and hard-to-track 
errors.

> The question is, why are we using a size variable for error reporting?

Because, in addition to not using exceptions, we also disagree on what 
exceptions should be used for. Exceptions are to be used for exceptional 
cases.

For a function whose objective is to find the index of an element which may not 
be there, the element not being there is not exceptional.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Qt5-feedback mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback

Reply via email to