C++
C++
by trg_thanh
C++
by trg_thanh
Meanwhile, Rust punches you in the face for the mere suggestion. Again. And again.
Python happily nods, runs it one page at a time, very slowly, randomly handing things off to a C person standing to the side, then returns a long poem. You wanted a number.
Assembly does no checking, and reality around you tears from an access violation.
EDIT: Oh, and the CUDA/PyTorch person is holding a vacuum sucking money from your wallet, with a long hose running to Jensen Huang's kitchen.
Rust just keeps telling me "you didn't actually learn how references work" over and over
Lifetime annotations go brr
I refuse to believe the python one ever happens. Unless you are importing libraries you don't understand, and refuse to read the documentation for, I don't see how a string could magically appear from numeric types.
You don't see how type mismatch errors can happen in a dynamically-typed language? Then why do they happen all the time? Hell, I literally had a Python CLI tool crash with a TypeError
last week.
LLMs are often python based, so they're not wrong per se, I just wouldn't consider them to be correct
Am I bad at programming?
No, it’s the language thats wrong.
Except that many other languages have proven that C++ is simply terrible at providing meaningful errors.
I wish there was something like that for SQL
The whole point of a segfault is that you can’t really know anything about it. Even in rust, when you get a segfault there is no meaningful error.
I mean, this is correct in many cases, unironically.
It should be one of the core purposes of a programming language to help humans to write the code they intend. If a language doesnt do that then it's bad.
I tend to disagree. The language should allow me to do things, and what is simple and obvious logically should be simple and obvious in the language (I am looking at you, JavaScript with [] != [])
What I intend - well, more than half my work is figuring out what I intend, language should have no say in this, save things like "we do this kind of trick like this here" (for example, C++ has no concept of "interface" entity. Ok, looks like I can use virtual class instead)
It is when languages start trying to be "helpful" they become an ugly mess: meaningful white spaces in Python? The whole shit with prototypes and objects in JS(see above)? Fuck this shit, I am not going to call those two good programming languages
Valid languages:
That's it
Brainfuck has entered the chat
Ah, C++. An endless supply of footguns where the difference between a junior and a senior dev is knowing what parts of the language to never use.
Real C++ programmers pass by const ref and tell pointers to fuck off.
You can also make everything a smart pointer and be done with it.
I can count on more than one hand the number of large scale projects where converting everything to smart pointers fixed major memory issues. Even if smart pointers can’t handle circular references, the number of projects that just don’t manage their memory correctly at all and were fixed by introducing these tools is way too high.
const ref or unique_ptr if you need ownership
I thought C++ was meant to get rid of C’s footguns?
It’s almost backwards compatible. You can use old or new foot guns.
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.
Bjarne Stroustrup
This is why I will never touch Javascript again. Long ago when I worked on web stuff, half my workflow was spent in the debugger tracing garbage to find where a typo was. The industry moved to Typescript, and now assuming the strictness checks are enabled, if some Typescript transpiles successfully, I can be 95% sure whatever fuckup I observe at runtime is a logic problem.
Weakly typed languages were an awful idea. But in general, if the compiler isn't able to detect most runtime issues (like with C++ here), it's not going to be the most productive language to use for building solutions compared to smarter alternatives.
I've thought about moving to typescript. Do you have suggestions for a 20+ year JavaScript dev?
Try porting a very small bit of behavior into a new tiny library or module that is Typescript based and independently published. Enable the strictness checks in tsconfig - really, really resist the urge to use any, and enforce that any is disallowed in tsconfig. Familiarize yourself with its utility types that really trip new authors up. "Record" comes to mind here, and others that involve generics if you haven't before worked with generics. Some of the type error messaging can be pretty obtuse - don't be afraid to paste them into an LLM (or use Copilot enhanced Intellisense) to explain what it actually means. IMO the type violation messaging is a weak dev experience point for new authors, so don't sweat it if you occasionally "struggle to make the squiggles go away".
Just try it. You can usually convert a single file at a time. Start small (or even with a pet project)
I suggest against it. Just use JSDocs syntax and typescript (the CLI and VSCode checker) will check it. No need to use transcompiler anymore. It was more useful when JS itself was more ES5 based and CommonJS.
Using something like esbuild will get you minification if you want it, but it's only for deployment, not actually needed for runtime. Having pure JS code is much easier to work with and debug.
If you tell the Compiler to be careful and avoid writing c code c++ does not segfault. This is a user error.
You can technically even write Assembler code and compile with gpp.
Does it count as user error if the user has to micromanage the compiler?
This is something that Rust is specifically designed to prevent.
C/C++ is mildly obsolete now, basically. Breaking the memory model is not really a small defect that's a matter of taste.
There are C++ analyzers like this which are also designed to prevent it (if you have no choice between languages).
Man, fraggles really do love radish though.
Congratulations, you've illustrated the difference between syntax and semantics. But any competent compiler also handles semantics (just in a separate phase of compilation), because that's necessary for any useful conversion to machine code, not to mention optimizations.
It's more like they handle a smaller, toy version of semantics that you can actually code a compiler for. In OP, something semantically correct in that version but not by common sense was accidentally written.
Maybe an early LLM that talks about picking up fire would be a better analogy.
Typescript on the other hand: Exwuse me sir, you seem to have a little oopsie right here. Oh right! Let me just fix that right up.
HERE ARE TWO THOUSAND ERRORS! YOUR PUNY LITTLE BUFFER CAN'T EVEN SCROLL BACK TO READ THEM ALL! AND YOU CALL YOURSELF A PROGRAMMER?
Just me or is the single speech bubble loop in the 4th panel weird?
Very. It's like they're both saying it in unison.
It makes sense to me. You start in the top left like how you read and then you get a direction for the order of the conversation. I read it naturally at intended the first time through.
It reads fine. It's the connection between the bubbles that's incorrect.
What surprised me the most was the speed of the compilation, must be a very small program. I tried to compile Godot from source once. Force-stopped it after 3 hours
There's a reason the play is called waiting for Godot
How many cores do you have and what compiler was it ? Also RAM can help with huge codebases iirc. When I was working with UE5 I had the best Ryzen available with 128 Go of RAM, could compile the engine (which is much bigger than Godot) from source in less than 2 hours iirc (yes that is a full clean+rebuild, not just compiling recent changes)
i7-7700 with 16GB of RAM :/
Make sure to use all your threads: make -j4
or however many cores/threads you would like to use
Why are you trying to compile an actress? What is a human's "source"? Their DNA? I'm surprised that the compiler even tried.
Is C++ the first enemy that managed to win against one punch man?
I mean, the comic is fine I guess, but if it implies the Cpp lady is hitting you, it's not. That would be the kernel, the lady did what you told her to do.
If undefined behavior is triggered anywhere in the program, then it is allowed by the standard for the process to ask the anthropomorphized compiler to punch you.
100% based and standards-compliant comic
In some build modes clang will simply put a trap where it sees undefined behavior. https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
Not saying your wrong, just a fun fact I guess
Yeah that is fun, credit where it's due, compilers do a lot of cool work behind the scenes.
Makes me think of:
I once wrote bind_front()
and move_only_function
likes in C++17. This nearly drove me mad because you cannot refer to a overload set by a name.
On the otherhand, I can now decipher the template error mess that the (g++) C++ compiler spews out.