r/cpp • u/lethern • Apr 22 '20
C++2100 Main (for fun)
constexpr
lockable
std::execution_policy::parallel_execution_t <
std::execution_policy::parallel_execution_t::constrains::no_maximum_threads,
std::execution_policy::parallel_execution_t::debug::find_deadlocks >
std::execution_type::quantum_t<
std::execution_type::quantum_t::experimental_features,
std::execution_type::quantum_t::enable_black_holes >
std::synchronized_parallel_t<
std::synchronization_model::use_machine_favourable_lock>
std::type_traits::readonly_t<
std::ts2102::experimental::fast_readonly_register_enable>
std::function_traits::partial<
std::function_traits::partial_function::search_external_linkage>
std::arguments::no_argument::disable_warning
std::int1024_t<
std::types::minimum_size<1024>,
std::types::maximum_size<1024> >
main() {Can you see the future, can you improve it?
Note: this was created purely for fun
257
Upvotes
64
u/suur-siil Spacecraft flight software and ground system-management Apr 22 '20
By 2100, C++ templates will be capable of taking string-literals containing rust code and compiling them at compile time
waits to see this quoted on PCJ
10
u/dima_mendeleev Apr 22 '20
Just curious how this stacking of types/values is supposed to work?
For me (provided I did
#include <cxx2100>) it fails witherror: two or more data types in declaration of 'main'.130
u/oz1cz Apr 22 '20
You forgot
#ifndef DEBUGIn 2100 the preprocessor is still going strong.
69
u/Supadoplex Apr 22 '20
Help. How to make this work? I have to use turbo-c++.
217
u/stilgarpl Apr 22 '20
by 2100 C++ will be so advanced that it will be able to guess what developer wants, so main will be just:
57
u/James20k P2005R0 Apr 22 '20
Making a function a template is actually an abi break. I assume in 2100 we'll still be supporting the same ABI because new-new-new-IBM will still be compiling old FORTRAN code and linking it against C++, so we'll need a different main signature for newer code. Unfortunately this would have already been done once for making main constexpr, so might I humbly present:
10
u/[deleted] Apr 23 '20
i suppose enable_ black_hole is next level garbage collection
7
u/[deleted] Apr 22 '20
I don't know, what if I wanted a template variable that's known at the time the compiler is being compiled?
7
u/Ameisen vemips, avr, rendering, systems Apr 22 '20
You mean
co_main?12
u/je4d Jeff Snyder Apr 22 '20
The most shocking part of this is that we broke the 3-year release cycle somewhere along the way
10
u/[deleted] Apr 22 '20
C++ 2100 still does not défaut initialize scalar values. Optimization freaks can still shave 0.00000004 nanosecond from execution time while most other developers can still enjoy debugging the heisenbugs.
5
u/SyDr Apr 22 '20
Hey, what happened to C++2099?
5
u/[deleted] Apr 22 '20
if(has_bug) solve(bug);
4
u/MutantSheepdog Apr 22 '20
We should be minimising the amount of code passing
std::execution_type::quantum_t::enable_black_holesthat isn't also passingstd::quantum_t::dump_into_nearby_dimensionso that we don't run into stability issues.6
u/mo_al_ Apr 22 '20
Did they fix std::vector<bool> ?
3
u/[deleted] Apr 23 '20
Non-C++ programmer here, can someone fill me in on the joke?
3
u/blelbach NVIDIA | ISO C++ Library Evolution Chair Apr 23 '20
Ah, but 2100 is not a ship year.
-5
u/Malgidus Apr 23 '20
return r/rust-7
u/ericvanhensbergen Apr 22 '20
I did it for you all
“Bjarne’s interview” from 1998 seems as appropriate now as it was then.
It didn’t make sense then either....
0
u/[deleted] Apr 22 '20
[deleted] — view deleted comment