[cfe-commits] [Patch][libc++] Mark vector:: and string::empty() as warn_unused_result

Howard Hinnant hhinnant at apple.com
Wed Apr 11 06:40:41 PDT 2012


On Apr 10, 2012, at 11:49 PM, Nico Weber wrote:

> Hi,
> 
> the attached patch marks vector:: and string::empty() as
> warn_unused_result. It looks like it's fairly often confused with
> clear() in practice:
> 
> https://breakpad.appspot.com/377003/
> http://codereview.chromium.org/10034006/
> http://www.viva64.com/en/a/0079/ (search for "empty")
> 
> See also http://llvm.org/bugs/show_bug.cgi?id=10011 for a more general approach.

I think I would prefer to have a documented/designed general direction to this problem before ad-hoc patching.  Thank you for referencing http://llvm.org/bugs/show_bug.cgi?id=10011 which has the beginnings of a discussion on this issue.

Howard




More information about the cfe-commits mailing list