Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My favorite C++ joke is this limerick that has been in the standard for a while:

    When writing a specialization,
    be careful about its location;
    or to make it compile
    will be such a trial
    as to kindle its self-immolation.
https://eel.is/c++draft/temp.expl.spec#8


An other one from the standard:

  void trex(volatile short left_arm, volatile short right_arm);   // deprecated
https://eel.is/c++draft/depr.volatile.type#example-3


This is one of the surviving improvements from JF Bastien's P1152 which was initially successful in deprecating most of the spurious use of volatile from C++ with a view to some day getting in there and actually doing MMIO properly.

Unfortunately too much of this will be unwound in C++ 23 because WG21 voted to un-deprecate all the volatile compound operators despite knowing nobody could even offer a rationale for why or how most of them would ever be correctly used.


I think [1] explains well why this will be un-deprecated.

[1]: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p23...


Note that P2327 is not what was actually done.

P2327 would be in my "not angry just disappointed" category. Of course WG21 think rotten archaic C code should be valid C++ 23 and the belief from embedded devs who write this stuff that it's probably all fine despite no evidence whatsoever should be enough to sail through committee.

WG21 voted to amend the draft to un-deprecate all of the volatile compound assignments instead, at Kona IIRC.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: