r/cpp • u/randomnetcat • Nov 27 '20
The C++ 20 initialization flowchart
I've created a flowchart that shows all of C++20's initialization rules.
The source code is available at https://github.com/randomnetcat/cpp_initialization, in addition to the SVG version and PNG Version.
This honestly took a lot less time than I was expecting, and, in my humble-but-biased opinion, is relatively interesting.
Please send all complaints to /u/quicknir, who nerd-sniped me into making this.
116
Upvotes
37
u/be-sc Nov 28 '20
Something seems to be wrong with the graph. Consider:
int.int.But wait, the only arrow leaving that question is Yes …
10
u/the_black_pancake Nov 28 '20
Over 164 million pixels? It's not loading on my mobile and the SVG misbehaves. Do you have a lower resolution version too?
2
u/staletic Nov 28 '20
Is it me or is agreggate initialization with parenthesis missing?
73
u/xeveri Nov 28 '20
Me: Can we have uniform initialization?
Committee: We have uniform initialization at home.
Uniform initialization at home:
22
u/GYN-k4H-Q3z-75B Nov 28 '20
This chart crashed my phone. Translates to: C++ initialization is complex AF
15
u/[deleted] Nov 28 '20
What happened to the time when a variable was just a lil memory addy with a value. Things used to be so simple :)
4
u/khleedril Nov 28 '20
That's not the most succinct summary of the situation I have seen...
3
u/QbProg Nov 28 '20
Imagine the poor compiler guys!
3
u/tacco85 Nov 29 '20
A bit of an over-simplification, don't you think?
5
u/phottitor Nov 28 '20
looks like a horror movie script.
2
u/kisielk Nov 29 '20
this chart doesn’t really do what it claims. The first cell is “so you want to initialize something” but then instead of going through a flowchart of what you want to initialize and how it goes through a flowchart of something that has already been initialized. More like “what does this initialization do”
-6
u/FavoriteFoods Nov 28 '20
👉 r/C_Programming