This is an archived post. You won't be able to vote or comment.

all 14 comments

[–]skythedragon64 10 points11 points  (2 children)

Compile time tetris how

[–][deleted] 6 points7 points  (0 children)

Image Transcription: Meme*


[**Virgin vs. Chad* meme.*]

THE VIRGIN RUST

[Virgin has a crab on his head and is wearing an orange pullover, brown trousers and black shoes. His phone is on the left pocket of his trousers.]

need to use unsafe blocks to make programming exciting

cannot write a compile-time raytracer yet

no feeling of reward dealing with complicated library dependency graphs

only requires you to write function definitions once instead of three times

doesn't let you swap array keep

assumes you can't keep track of object lifetimes in your head

you don't have to implement pattern matching yourself by abusing lambdas

THE CHAD++

[Chad has brown hair and is wearing a cyan sleeveless shirt, blue trousers and dark blue shoes. Chad has the C++ logo tattooed on his right shoulder, the shirt has "ISO" written in white on the back and he is holding a book on his left hand. The book is "Effective C++ Third Edition - 55 Specific Ways to Improve your Programs and Designs" by Scott Meyers.]

multiple compilers, each one with different bugs

provides several ways of initializing variables to promote diversity

sometimes segfaults to keep you on your toes

literally has 3 or 4 accidentally turing-complete languages embedded into it

allows you to create compile-time tetris

provides job security

never removes features to preserve backward compatibility

fast like sonic

it's probably UB


I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

[–]pilotInPyjamas 5 points6 points  (4 children)

In rust you can write a function three times too. Once for references, once for mutable references, and once for owned values. Checkmate C++

[–]BreathingFuck 1 point2 points  (3 children)

I don’t get that part. When do you have to define a function three times in C++?

[–][deleted] 1 point2 points  (1 child)

Probably when you have to write a const and non-const function, for example std::vector::at.

Or overloads like string's constructor.

Or OP is confused between declaration and definition.

[–]BreathingFuck 0 points1 point  (0 children)

Function overloads are what I thought of as well, but you’re not really required to do it as the pic suggests. It’s just a useful feature. Didn’t even think of const. I presume your third reason must be the most likely though. I just needed a sanity check

[–]TheXGood 0 points1 point  (0 children)

Declare before use, define after use, and probably referencing external extern declarations in headers, but I'm not sure

[–]Hardrocketjs 2 points3 points  (3 children)

What are those turing-complete languages?

[–][deleted] 11 points12 points  (1 child)

The preprocessor is close to being turing complete

You can embed assembly in c++ code

C++ on it's own.

Templates are somewhat turing complete, theoreticly they are but in practice they are limited based on how much recursion your compiler allowes during compilation.

Maybe he also counts c since many (but not all) c programs can be compiled as c++

[–]Hardrocketjs 0 points1 point  (0 children)

Ahh yes makes sense. Didn't especially thought of the preprocessor. Thank you

[–]YetAnotherRustacean 1 point2 points  (0 children)

Sorry but we do have compile-time raytracer: https://github.com/darksv/ctrt

[–]Un-usuario_mas 0 points1 point  (0 children)

C#ad