Proper digit separators in C++

Have you ever hoped that C++ would have digit separators? That you wouldn’t have to strain your eyes when reading 2147483647 (is it std::numeric_limits<int32_t>::max(), or is it just similar)? That you wouldn’t have to count the zeros 5 times when typing 1000000000?

Well, the C++ Standards Committee doesn’t have your back. Oh, sure, they have introduced a digit separator, – , but it’s completely unusable in production code! Here’s why.

Readable function pointers

Consider the following declaration

char*(*(*foo)(int(*)(char*,char*)))[]

It’s artificial (generated with the ever-helpful geordi bot), although I’m sure that if you looked hard enough, a similar one would appear somewhere in the wild. In the above case, foo is a pointer to function taking pointer to function taking char* and char* and returning int returning pointer to array of char*. I think that even seasoned C and C++ programmers will agree that this is quite confusing at first glance. Or second. And third. Especially for people less versed in “C gibberish”, as cdecl.org aptly calls it.