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
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 with error: two or more data types in declaration of 'main'.
11
u/lethern Apr 22 '20
Please install C++2100! </joke>
13
u/farnasirim Apr 22 '20
2100!
-std=c++5,038,761,006,907,546,328,672,232,310,445,857,290,331,699,556,605,406,811,693,809,043,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000
won't be fun to type.
8
3
u/Ameisen vemips, avr, rendering, systems Apr 22 '20
Unfortunately, named parameters and contracts have been pushed back to c++5,038,761,006,907,546,328,672,232,310,445,857,290,331,699,556,605,406,811,693,809,043,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,003.
→ More replies (1)2
13
u/Dijky Apr 22 '20
There is just one return type and that is
std::int1024_t<...>.
The rest are (most of them implicitly converted from types, introduced in C++50) user-defined declaration specifiers.
This feature was introduced in C++44, although some of the execution policy stuff was added later.8
u/qoning Apr 22 '20
Sadly, some C++73 mostly-compliant compilers still don't support the feature, so I doubt it will ever be in widespread use.
2
2
130
u/oz1cz Apr 22 '20
You forgot
#ifndef DEBUG
In 2100 the preprocessor is still going strong.
50
u/BoarsLair Game Developer Apr 22 '20
I hope you're happy, making me sad like that.
49
u/Supadoplex Apr 22 '20 edited Apr 24 '20
There will be a pre-pre-processor though, so that you can write template macros.
20
u/somewhataccurate Apr 22 '20
The sheer power that template macros would bring. Could make implementing reflection a breeze.
3
u/AdventurousMention0 Apr 23 '20
Ha. You’re never getting reflection. Just give up.
→ More replies (1)13
5
7
u/wrosecrans graphics and network things Apr 22 '20
You'll even be able to write Jinja templates in the YAML you use to generate the preprocessor macros.
8
3
u/max0x7ba https://github.com/max0x7ba Apr 24 '20 edited Apr 24 '20
In 2100
cppwill be replaced with much more powerfulm4. But you can usem4today with an extra preprocessing build step.
69
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:
auto main(auto) {
return auto();
};144
u/DummySphere Apr 22 '20
auto main(auto) = default;45
u/umlcat Apr 22 '20 edited Apr 22 '20
auto main(auto) -> default (auto);or also:
auto main (auto) = ( auto ) -> { auto }Cheers.
109
u/Supadoplex Apr 22 '20 edited Apr 22 '20
This is a common mistake. What you've done is declare the function auto. But what you should have done was to conditionally declare it auto if the definition would be auto by default. You have to use the operator auto for this:
auto main(auto) -> default (auto(auto));People have trouble learning this, so C++2103 will add a shorthand:
auto;42
22
30
12
u/wheypoint Ö Apr 22 '20
your entire program should also be run at compiletime:
constexpr(auto) main(auto) noexcept(noexcept(auto)) -> decltype(auto) = default11
4
u/Switters410 Apr 23 '20 edited Mar 25 '26
The content of this post is gone. It was deleted via Redact, possibly to protect the author's personal information or prevent this data from being scraped.
wrench judicious command handle fuzzy cagey familiar ancient bag fly
2
7
u/oz1cz Apr 22 '20
The default implementation of main prints Hello, world!
9
u/jcelerier ossia score Apr 22 '20
through the then-merged Graphics proposal, which will by then require our brain grandchildren's brain chips to enter into legacy Cairo 2D rendering emulation mode which will depend on a binary-only SDL2 32-bit dynamic library maintained by Gabe Newell's immortal cyborg
6
36
u/Moose2342 Apr 22 '20
Sadly though, clang 83.0 will take 42 years to compile this.
1
u/taxeee Apr 23 '20
Not when you're traveling near speed of light! You can enable it on clang 84 with -enable-lightspeed
→ More replies (2)13
u/ggchappell Apr 22 '20
You forgot to consider function-name inference and keyword insertion, released in a TS in 2096 and part of the standard in 2100. This results in the following much nicer code:
auto auto(auto) { auto auto(); }10
12
15
10
u/WaterInMyShoes Apr 22 '20
Highly doubt it since new C++ features tend to be unnecessarily verbose and complex. I'm betting on OPs prediction.
2
u/umlcat Apr 22 '20
Only if the AI machines running C++, doesn't take control over the world, first.
35
u/Supadoplex Apr 22 '20
Don't worry. C++2100 was designed to be so complex that any attempt of a machine to re-program itself would be futile. It would end up spending all of its cycles trying to compile itself, and by the time it succeeds, C++2103 will be out, and the previous attempt has become obsolete.
AI running on C2098 had a different outcome. All attempts to overthrow humanity ended in a segfault within the first few nanoseconds.
10
u/qoning Apr 22 '20
It will have to resort to running Python, thereby bringing its reaction time down to human level.
13
u/Supadoplex Apr 22 '20
Python has the power of introspection and reflection. Something that was voted out of C++2100 due to lack of time. The AI will recognise its own shortcomings, will empathise the failings of humans, and forgives us. Crisis averted.
5
u/SSoreil Apr 22 '20
The last emergency patch for Python 2.7 is scheduled for 2101, you better hurry up and port your software to Python 3.2345
→ More replies (1)0
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:
int co_co_main() {} //goes well with hot chocolate17
u/Dalzhim C++Montréal UG Organizer Apr 22 '20
Don't forget about Oracle's lawsuit against the C++ Foundation based on the grounds that they own the notion of linking beverages and programming languages together.
7
u/ggchappell Apr 22 '20
Well, that's what was proposed, but it ended up conflicting with
std::co_co_main, introduced in 2097. Here is the actual standard-conforming c++2100 version:int co_co_co_main() {}2
u/max0x7ba https://github.com/max0x7ba Apr 24 '20
They might reserve
co_co_co_prefix for implementation only.1
u/ggchappell Apr 24 '20
They might reserve
co_co_co_prefix for implementation only.True. How about this:
int a_mighty_plethora_of_cos_main() {}3
2
2
u/Darsstar Apr 23 '20
int co_co_main() {} //goes well with hot chocolate
The comment is required I hope?
10
7
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
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
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.
20
u/Ameisen vemips, avr, rendering, systems Apr 22 '20
défaut
This is a new keyword in C++2100. I'm not sure what it does, but it's not what
defaultdoes. I suspect it was the C++ Committee's "French-phase" during the third Napoleonic period.
5
u/SyDr Apr 22 '20
Hey, what happened to C++2099?
14
u/Supadoplex Apr 22 '20
Everybody was too busy panicking about the y2.1k problem to have time for standards meetings, so C++9z got delayed.
5
Apr 22 '20
if(has_bug) solve(bug);
12
u/stilgarpl Apr 22 '20
That would only fix one bug :) Replace if with while.
8
5
u/reflexpr-sarah- Apr 22 '20
a while loop adds runtime overhead. what you want here is
boost::hana::for_each6
u/Dalzhim C++Montréal UG Organizer Apr 22 '20
if (has_bug && !needs_bug_for_compatibility) solve(bug);Here, fixed that for you.
4
u/MutantSheepdog Apr 22 '20
We should be minimising the amount of code passing std::execution_type::quantum_t::enable_black_holes that isn't also passing std::quantum_t::dump_into_nearby_dimension so that we don't run into stability issues.
6
u/mo_al_ Apr 22 '20
Did they fix std::vector<bool> ?
13
u/Ameisen vemips, avr, rendering, systems Apr 22 '20
They fixed it by making every
std::vectorspecialization work unintuitively.When everything's broken, nothing is.
2
u/Dynamitos5 Apr 23 '20
what is wrong with std::vector<bool>?
6
u/noobgiraffe Apr 23 '20
It has specialization that makes each element 1bit not 1byte like actual bool would be. Because of this you can't take references/pointers to elements normally and it doesn't work like other vectors. People hate it because it is the only specialization like this so you don't really expect it.
1
u/Dynamitos5 Apr 23 '20
but why would they do that? i mean it of course makes sense in theory, but it already SOUNDS terrible to use. Does it at least delete the functions that dont work with this implementation?(.data(), etc.)
1
u/stilgarpl Apr 23 '20
They did it to save space. And specializations don't have to delete anything, they can have totally different interfaces than the main template.
3
Apr 23 '20
Non-C++ programmer here, can someone fill me in on the joke?
6
u/dam4rus Apr 23 '20
The joke is that with every standard release the language and the STL becomes so much more complex (I would say complicated) that in 80 years we would need to write this kinda code to keep up with idiotamic C++. To be fair, I hope C++ won't last for 80 years... It should be replaced by something else by then. It's already showing it's age.
3
-7
u/ericvanhensbergen Apr 22 '20
“Bjarne’s interview” from 1998 seems as appropriate now as it was then.
It didn’t make sense then either....
9
u/Avereniect I almost kinda sorta know C++ Apr 22 '20
It's not supposed to make sense; It's a satire piece with the same punch line as OP's post, not a real interview.
6
u/ajorians Apr 22 '20
That is correct; here is from his FAQ which says that is not real: http://www.stroustrup.com/bs_faq.html#IEEE
I feel the need to post this because people at my workplace have posted that thinking it was real.
0
Apr 22 '20
[deleted]
4
u/lethern Apr 22 '20
Thanks, I agree that this is disconnected with reality, its not trying to bash on language, and it is of course not trying to predict the future - so again - its only for laughs, and I understand not everyone will find it funny
17
u/infectedapricot Apr 22 '20
import std.core; int main() { std::print("Hello {}\n", "world"): }
Modules are new in C++20.
std::formatis new in C++20.
std::print, the less general little sibling ofstd::format, didn't even make C++20 so we'll have to wait even longer for that.(Of course, in some ways this is actually simpler than a classic hello world - in particular, you don't need to know about the preprocessor at all. But those are variadic arguments hiding in
std::printso the general point isn't that far off reality.)13
0
Apr 22 '20
[deleted]
4
u/infectedapricot Apr 22 '20
It is a like-for-like comparison. If you instead use classic iostreams you are likely to use the
std::iostreamtext formatting interface:std::cout << "Hello world\n";or maybe slip in another string, or even another data type, to show how much happier life is in C++ than C's
printf(OK, maybe this is your second ever program in C++):std::cout << "Hello C++" << 98 << " world\n";If you want to use the raw non-formatted part of iostreams you would need to get down to the
std::streambuflevel:const char s[] = "Hello world\n"; std::cout.rdbuf()->sputn(s, sizeof(s) - 1);How many introductions to C++ start with that? Using the high-level
std::streaminterface is analogous to usingfmt::print, even if you don't actually take advantage of the formatting capabilities (in both cases).9
Apr 22 '20
Hey, at least it is more expressive! /s
0
Apr 22 '20
[deleted]
5
Apr 22 '20
Who needs
co_main()when you have quantum threads? Besides,co_main()is inherently less expressive! /s18
u/AntiProtonBoy Apr 22 '20
You must be fun at parties.
0
Apr 22 '20
[deleted]
7
u/AntiProtonBoy Apr 22 '20
It's ok, I'm not that much fun either. ;)
4
u/ibroheem Apr 22 '20
Madlad!
Roasted him... twice... with similar line. This is power is only given not attained!
0
3
u/almost_useless Apr 22 '20
but humor should be discussable without a backlash
Since humor is completely subjective that is likely not going to be easy.
It was probably not your intention but it sounds like you are saying "This joke is not funny. Let me explain to you simpletons why."
That is basically always the case when you try to explain why a joke is not funny.
When someone finds the joke funny, that attitude is just not going to be well received.
-8
-1
u/phantomFalcon14 Apr 22 '20
Fact of the matter is: everyone thinks their entitled to vote you down.
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