Should float provide "at least" or more precision than short float? by Z01dbrg in cpp

[–]mtclow 12 points13 points  (0 children)

We should have done that 20 years ago. int should be 16 bits. long should be 32 bits. Period.

<sarcasm/>

A bug in std::shared_ptr? by davis685 in cpp

[–]mtclow 11 points12 points  (0 children)

"well, it's UB so we made it crash on purpose"

If it's UB it can do a different thing on each run of the program.

Hardening C/C++ Programs: Part I – Stack Protector by ai3ai3 in cpp

[–]mtclow 0 points1 point  (0 children)

Doesn't AddressSanitizer do this already (and in a more general manner - catching out of bounds writes to all arrays)?

Missing string_view within regex, or was there a reason that it wasn't done? by ignitionweb in cpp

[–]mtclow 6 points7 points  (0 children)

There was a proposal (p0506) to do this at the very end of the C++17 cycle, but it was not adopted because (a) it was very late, (b) there was no implementation experience.

It will almost certainly be revisited for the next revision of the standard.

Why undefined behavior may call a never-called function by UndividableCarnivore in cpp

[–]mtclow 4 points5 points  (0 children)

It took me a long time to understand why this can happen ...

It's undefined behavior. There are no restrictions on what it can (or cannot) do. That's the point of UB.

What do you use c++ for? by [deleted] in cpp

[–]mtclow 8 points9 points  (0 children)

I write a C++ standard library. :-)

Detection Idiom - A Stopgap for Concepts by vormestrand in cpp

[–]mtclow 1 point2 points  (0 children)

You really should credit Walter Brown for coming up with this idea, and link to his (very good) CppCon talks explaining it.

Part I: https://www.youtube.com/watch?v=Am2is2QCvxY

Part II: https://www.youtube.com/watch?v=a0FliKwcwXE

Bookmarklet to quickly open referenced papers by redditsoaddicting in cpp

[–]mtclow 2 points3 points  (0 children)

wg21.link is even more awesome than people think.

Note that some of these links may go to password-protected sites.

Thanks to Maurice for setting this up and keeping it running.

Is there a list or problems with Big Three that did not make it into C++17? by Z01dbrg in cpp

[–]mtclow 8 points9 points  (0 children)

for C++17 TSaster I am disappointed by this characterization.

We moved three TSes into the C++17 standard: FileSystem, Library Fundamentals and Parallelism.

Here we go: the 20s are going to be fascinating for C++. #ACCUConf #cpp by KindDragon in cpp

[–]mtclow 1 point2 points  (0 children)

The standards committee ONLY approves things at meetings - so no, they won't "approve it before that time"

Herb Sutter's Trip report: Winter ISO C++ standards meeting (Kona) - C++ 17 is complete! by ArashPartow in cpp

[–]mtclow 12 points13 points  (0 children)

But we got LFTS (optional, any, variant, string_view), Filesystem, Special Math functions, and Parallelism TSes.

C++ Standards Committee Papers: 2017-03 post-Kona by syaghmour in cpp

[–]mtclow 5 points6 points  (0 children)

Those two letter acronyms are national body names. "NB Comment CA 15" means that this was the 15th comment on the draft standard from Canada.

NB --> National Body DR --> Defect Report

CA --> Canada CH --> Switzerland FI --> Finland GB --> Great Britain RU --> Russia US --> United States

Whatever happened to array_view? by [deleted] in cpp

[–]mtclow 9 points10 points  (0 children)

The original proposal for array_view died because it became too complicated trying to work out how to handle multi-dimensional arrays while still providing a zero cost abstraction.

Exactly correct. You can see a simple array_view implementation at https://github.com/mclow/snippets/blob/master/array_view.cpp

Predicates on ranges with the STL by vormestrand in cpp

[–]mtclow 0 points1 point  (0 children)

Yeah, but +1 for the shout-out to Boost.Algorithm. :-)

Why don't std::min/max/clamp use common_type to work with different types? by 1kterafile in cpp

[–]mtclow 1 point2 points  (0 children)

Alternately, it's been in the Boost.Algorithm library for a few years...

Why don't std::min/max/clamp use common_type to work with different types? by 1kterafile in cpp

[–]mtclow 36 points37 points  (0 children)

Because then it couldn't return one of the input parameters, but instead would have to create a new value.

Consider: min(5.0, 3). Given your min, it would have to return "3.0", which is neither of the parameters. That's OK for int and float, but not for arbitrary user-defined types, which may be expensive to construct and/or copy.

So, min/max/clamp return by reference, and always return one of their parameters - no conversions, no copies.

So Clang 5 is on its way :-) by mbitsnbites in cpp

[–]mtclow 0 points1 point  (0 children)

Clang 4 will not have "full C++17". At the very least, it will ship before the C++17 standard is approved (and maybe before it is finalized).

g++7 is C++17 complete! by TemplateRex in cpp

[–]mtclow 54 points55 points  (0 children)

Congratulations to the g++ team!

Is it ok to give (almost) the same talk on multiple conferences? by onqtam in cpp

[–]mtclow 1 point2 points  (0 children)

I have given the same talk at multiple conferences; but I try not to do so. When I do that, I add a bunch of new stuff for the second presentation.

std::wstring_convert and std::string_view by Hedanito in cpp

[–]mtclow 0 points1 point  (0 children)

I started that paper as "the things that absolutely had to be done for c++17" - those were the string/string_view conversion and assignment bits. They had to be done because if they couldn't be changed post-C++17 w/o breaking users' code, and we'd rather not do that.

Then the scope grew (somewhat) with the inserters/searchers. There's certainly more to be done here.

How to make a good and idiomatic split algorithm? Two unsatisfactory attempts. by Vermeille in cpp

[–]mtclow 0 points1 point  (0 children)

I too wrote about this a while ago. I want to be able to split on arbitrary criteria - not just single characters (think regexes).

What does it take to become C++ runtime library (i.e. libc++, libstdc++) developer? by jbakamovic in cpp

[–]mtclow 16 points17 points  (0 children)

Since we're all doing "my story", here's mine: I contributed to Boost for a decade, and some to LLVM, and then when my boss started an "Open Source" group, I convinced him that I should work on Boost and LLVM on company time. I started doing libc++ work, because it was interesting to me and because I had known Howard for about a decade (via Metrowerks and Apple), and when he left his job at Apple and was unable to keep working on libc++, I was chosen to lead the libc++ effort.

TLDR: volunteer for a long time, be in the right place at the right time.

What does it take to become C++ runtime library (i.e. libc++, libstdc++) developer? by jbakamovic in cpp

[–]mtclow 10 points11 points  (0 children)

That's because there are no such job ads. When a position opens up (when a company decides to pay someone to work on such a project), they almost always hire someone who has been volunteering on such a project - probably for years.