15
u/aearphen {fmt} Jun 23 '18
If we are rewriting all the code to move const around then we should probably consider two other alternatives:
Both const (universal const) - requires changes to the standard but totally worth it to reconcile the conflicting styles:
const int const i;North const:
const int i;
21
20
u/jcelerier ossia score Jun 23 '18
why not define types lisp-like
(* (const (int)) x;... oh wait, we can (and notice how the const is west-side as a proof of the superiority of the system)
std::add_pointer_t<std::add_const_t<int>> x;9
u/johannes1971 Jun 24 '18
North const
LOL :-)
I think to resolve this issue that now divides our community, we need a new standard. I propose uniform const:
auto a = {const 3}; // a has type 'const int const' auto b = {const &a}; // b has type 'const int const * const'5
u/aearphen {fmt} Jun 24 '18
Looks somewhat verbose. Wasn't there some proposal about natural (terse)
constsyntax?6
u/thukydides0 Jun 23 '18
South-East
const:int const* const p;4
u/cleroth Game Developer Jun 26 '18
You guys seem to have missed the part where reddit eats your newlines. :p
2
u/degski Jun 25 '18
Are you a flat-earther? Zenith const and nadir const should at least be made optional. ;-)
15
u/sumo952 Jun 23 '18
I hate (blog) posts without a date. Or am I blind?
In any case, wasn't this posted already a couple weeks or months ago?
12
Jun 23 '18
Oh, the evangelist strike force strikes again.
1
u/meneldal2 Jun 25 '18
That title is interesting, can't guess if it's about bikeshedding that always happen or bikeshedding about const.
5
u/xENO_ Jun 24 '18
Obviously north const is the way to go. That is to say, follow every const with a line-feed. /s
16
u/doom_Oo7 Jun 23 '18
West const all the way
24
u/thukydides0 Jun 23 '18
You mean
const West.13
u/IcyWindows Jun 23 '18
I think part of the appeal is that the adjective goes first like in English. "const west" would be the east way to say it. ;)
3
4
2
u/matthieum Jun 24 '18
As a French, were adjectives usually go after the name they qualify, I've always thought of English as backward ;)
8
4
2
u/Kronikarz Jun 24 '18
My personal favorite is type const or template <typename T> using cnst = T const;
And then you get stuff like ptr<cnst<char>> str = "hello";
1
u/imMute Jul 07 '18
So basically
std::add_pointer_t<std::add_const_t<int>>but with less typing and less standardization?1
u/Kronikarz Jul 07 '18
Yes. I don't use it, really, as I am a fan of the verbosity, I just like the clean look of that syntax.
61
u/johannes1971 Jun 23 '18
The evangelism on what is just another stylistic choice is getting tiresome.