|
|
Log in / Subscribe / Register

The 5.7 kernel is out

The 5.7 kernel is out

Posted Jun 1, 2020 20:37 UTC (Mon) by Cyberax (✭ supporter ✭, #52523)
In reply to: The 5.7 kernel is out by mathstuf
Parent article: The 5.7 kernel is out

Some of them DID get fixed, like vector<bool>.


to post comments

The 5.7 kernel is out

Posted Jun 2, 2020 1:49 UTC (Tue) by mathstuf (subscriber, #69389) [Link] (2 responses)

Do you have a paper number for that?

The 5.7 kernel is out

Posted Jun 2, 2020 2:27 UTC (Tue) by Cyberax (✭ supporter ✭, #52523) [Link] (1 responses)

I think P1957R2 but I can swear I've seen another one about implicit bool casts.

The 5.7 kernel is out

Posted Jun 2, 2020 2:44 UTC (Tue) by mathstuf (subscriber, #69389) [Link]

Those papers do nothing about vector<bool>'s problems:

- auto& item = boolvec[3]; is busted as you get a proxy object instead of a real boolean
- does not work with parallel algorithms (the bits all write to the same byte and collide there)
- T* data = vec.data(); doesn't work in generic code when passed a vector<bool>
- I'm sure there are others

It's just a bad design the standard allows (it's not even required!) that won't get fixed due to ABI guarantees stdlib implementers are basically bound by from the ecosystem. Sure, the standard can tell them to do something, but they can also say "sorry, no can do" (they effectively have a veto on such things because of this).

The paper you refer to is basically about making T* -> bool a warning due to bugs and weird typesystem holes you fall into with the implicit cast floating about your generic code.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds