Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Standardizing on the shoulders of giants

Standardizing on the shoulders of giants

Fall C++ standards meeting trip report at Rackspace Atlanta.

Zhihao Yuan

October 16, 2013
Tweet

More Decks by Zhihao Yuan

Other Decks in Programming

Transcript

  1. Background of std::optional • Originally boost::optional • Vocabulary type[1] of

    a generic Nullable concept[2] ◦ Empty function std::function<...>{} ◦ Empty pointer nullptr • Literal type, in place initialization, etc.
  2. Challenges • Relational operators ◦ Previously broken in Bristol ◦

    New design decided within 30mins • Mixed type assignments ◦ Still exploring
  3. What we learned Any attempt to standardize an existing practice

    should go to a Technıcal Specıfıcatıon first.
  4. From now on File System TS • boost::filesystem V3 Library

    Fundamentals TS • std::experimental::optional • std::experimental::any • std::experimental::string_view (string_ref)
  5. War of std::rand • The paper[3]: add global_urng() etc., deprecate

    std::rand families and random_shuffle • LEWG: No time for addition, just kill them. • LWG: +1! • The committee: No replacement; go away.
  6. War of std::rand • The paper[3]: add global_urng() etc., deprecate

    std::rand families and random_shuffle • LEWG: No time for addition, just kill them. • LWG: +1! • The committee: No replacement
  7. The procedure of depreciation • Show the problem • Find

    replacement • Deprecate • Deprecated means “identified as a candidate for removal from future revisions”[4]; still normative, may not get removed.
  8. “Show the problem” • “XXX’s implementation of rand provides crypto-strength

    randomness” • “For a beginner who wants to roll dice, rand is good enough”
  9. “Find replacement” • Accessibility of the global random engine •

    Thread-safety • Seeding • Bikeshedding ◦ Bjarne: naming debates, like syntax debates, often cover for something deeper
  10. From now on /* I just selfishly listed the things

    I know */ • std::rand, with std::randint • setiosflags..., with std::experimental::putf • vector<bool>, with ??::bitvector
  11. What C++14 have? • Read the “Adopted” papers http://www.open- std.

    org/JTC1/SC22/WG21/docs/papers/2013/ • cppreference.com, items marked (C++14)
  12. References [1] Pablo Halpern. “Polymorphic Memory Resources”. http://www.open-std. org/JTC1/SC22/WG21/docs/papers/2013/n3726.pdf [2]

    F. Cacciola, A. Krzemieński. “A proposal to add a utility class to represent optional objects (Revision 4)”. http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2013/n3672.html [3] Walter E. Brown. “Three <random>-related Proposals, v2”. http://www.open-std. org/JTC1/SC22/WG21/docs/papers/2013/n3742.pdf [4] “Compatibility features”, Annex D of Workıng Draft, Standard for Programmıng Language C++. http://isocpp.org/files/papers/N3797.pdf [5] Zhihao Yuan. “std::rand replacement” http://students.cs.niu.edu/~z1565938/randint.html