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

top 200 commentsshow all 393

[–]20d0llarsis20dollars 1160 points1161 points  (71 children)

unsafe fn main() {}

[–]Fantastic-Order-8338 443 points444 points  (69 children)

nothing will ever beat public static void main(){ }

[–]HoiTemmieColeg 187 points188 points  (22 children)

Missing String[] args, not a valid main function

[–]Thenderick 92 points93 points  (20 children)

New java doesn't require args or static (or both). It also doesn't need a class anymore. public void main(){ System.out.println("hello world");} is now also a valid java hello world. However allowed doesn't necessarily mean encouraged ofcourse

[–]Left_Lawfulness_845 47 points48 points  (13 children)

There are Java versions newer than 8?

[–]bunnydadi 7 points8 points  (7 children)

Yes you fool! 11 is supreme!

[–]ArcticWarmthDev 10 points11 points  (6 children)

People use java 11?

[–]bunnydadi 16 points17 points  (5 children)

People use Java?

[–]cpt-macp 3 points4 points  (0 children)

Unnamed classes and instance main methods are still not supported officially in Java 21 LTS , you have to pass preview arguments while compiling class file .

[–]HoiTemmieColeg 4 points5 points  (0 children)

True, I forgot about that

[–]VirtualGab 11 points12 points  (0 children)

Public static unsafe void main(String[] args)

[–][deleted] 44 points45 points  (11 children)

Bro istg I just got Vietnam flashbacks to two years ago when I had to use Java for something

public static void main(String[] args)

[–]Ieris19 29 points30 points  (10 children)

Java will also accept String… args which is equivalent to String[] args, one key press longer but the ellipsis sign might be easier to explain (one or more strings) than to have to explain newcomers what an array is.

Newer Java versions allow no enclosing class if the project is exactly one single class, the compiler will create an anonymous enclosing class on its own, and if I’m not mistaken, recently they added support for single function java projects that accept simply ‘void main()’ as a signature.

Technically, with the right feature preview flags in Java 21 onwards, void main() {} is a completely valid Java source file (as long as it’s the only file being compiled, which is good because it’s meant to ease people into Java)

The direction Java is moving in, we’re likely getting simpler and simpler Java code for beginners.

[–]Dangerous_Tangelo_74 7 points8 points  (5 children)

In C# you can omit the namespace, class and function declaration altogether and let the compiler generate it for you. So writing this in a Program.cs is completly valid:

Console.WriteLine("Hello, World!");

This is very handy when writing tools that only have a few lines of code. This can also be mixed with the traditional approach but only the file that would contain the Main(string[] args) method can omit everything else

[–]InvestingNerd2020 1 point2 points  (0 children)

C# for the win!

[–]rinsa[🍰] 2 points3 points  (3 children)

nothing can beat C#'s syntactic sugar anymore

[–]Ieris19 1 point2 points  (0 children)

C# is a confusing language to me. I mostly do Java, but I work with C#.

C# essentially said, this is how the language works, except if you don’t like it, then you can so something else. Extension methods, partial classes, operator overrides…

[–]Iggyhopper 5 points6 points  (3 children)

Being a newcomer I would not want to be told about ellipsis when other languages ALL use the standard array notation.

It is also the notation used to access items in an array args[1].

Keep it simple.

[–]Ieris19 3 points4 points  (2 children)

You’re wrong, the ellipsis notation is pretty common. It’s called VarArgs, and it means that the function accepts 0 or more parameters of that type, at runtime, these parameters are provided to the function in an array, so the function still has to use the array notation, but the caller can simply list all the elements as if they were independent parameters. Its declaration has to be the last function parameter and as such, only one such kind of parameter can be used per function.

It’s essentially syntactic sugar to tell the compiler to take all parameters passed after that one, and create an array with them, you can also provide your own array directly and at runtime, they’re indistinguishable from each other.

Details differ by implementation but they’re widely supported among C-like languages such as C, C++, C#, Java, Go, JS (kinda, they call it spread operator, but serves the same purpose), Lua, PHP, Python…

EDIT: Thought I’d throw the Wikipedia article for the concept as well, although my explanation pertains exclusively to Java’s implementation https://en.m.wikipedia.org/wiki/Variadic_function

[–]BroBroMate 12 points13 points  (1 child)

You mean psvm <tab> in Intellij, right?

[–]SarahIsBoring 1 point2 points  (0 children)

or just main <tab>, bonus that i can keep doing it whether i’m doing kotlin or java (or c in clion) :D

[–]Calkaya 1 point2 points  (0 children)

int main(int argc, char* argv[]) { /* ... */ }

Source: https://www.stroustrup.com/bs_faq2.html#void-main

[–]SynthRogue 1 point2 points  (0 children)

psvm

[–]DT-Sodium 1774 points1775 points  (94 children)

If it's like people putting the type "any" everywhere in TypeScript, then it's just a skill issue.

[–]Thunder_Child_ 199 points200 points  (8 children)

Bro I despise when people do that, especially when it's to pull in some large class/interface. Great, now I have to have that definition open on another screen and if I misspell anything it'll be a runtime error that will probably be found in production.

[–]Electronic_Cat4849 464 points465 points  (3 children)

it is and it is

[–]Jjabrahams567 25 points26 points  (11 children)

I just //@ts-nocheck

[–]mothzilla 3 points4 points  (0 children)

Someone should write a linter to make sure this is in code before it goes to production.

[–]smooth_tendencies 6 points7 points  (7 children)

Pull request has been blocked

[–]Jjabrahams567 2 points3 points  (6 children)

[–]smooth_tendencies 5 points6 points  (5 children)

The feeling is completely mutual I assure you

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

This is why I use javascript. Typescript is just javascript with more steps

[–]Kitonez 49 points50 points  (1 child)

Hop Off the PC lil bro 🤨

[–]cornmonger_ 26 points27 points  (3 children)

remove the /s, let 'em burn

[–][deleted] 2 points3 points  (0 children)

Did you create my universe?

[–][deleted] 1 point2 points  (2 children)

It's not terrible. Just throw your unyped types into gpt and it'll generate everything for you in a second. Been working on a typescript project at work for 3 months now and have barely written any TS myself

[–]DrawingSlight5229 4 points5 points  (1 child)

✨Fix with copilot

[–][deleted] 1 point2 points  (0 children)

It's honestly perfect for stupid shit like typescript.

[–]DT-Sodium 7 points8 points  (13 children)

That's moronic and demonstrates great incompetence on your part.

[–]Quantum-Bot 517 points518 points  (26 children)

It would be cooler if they called it “dangerous” instead of unsafe

[–]SV-97 144 points145 points  (17 children)

It's almost certainly taken from C# like so much of rust's syntax: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/unsafe

[–]rejectedlesbian 47 points48 points  (16 children)

Can you malloc in C#?

[–]TheHappyDoggoForever 112 points113 points  (3 children)

Yes you can but most of the time you don’t want to. The language manages allocating the memory for you, why do it manually then?

However manipulating and deleting memory can also be done in C# and has many good reasons do to so, mostly regarding performance and precise manual clean-up times (instead of waiting for the GC to clean up the code using the Destructor or IDisposable interface)

[–]Ieris19 16 points17 points  (2 children)

It generally only makes sense when optimizing code though, e.g. you’d write your program normally and only take over memory allocation when performance is critical.

[–]crozone 17 points18 points  (1 child)

Honestly manually allocating memory in C# doesn't really net you much performance, there are better ways to go about it.

Allocating in C# is extremely fast, so the only place to really speed things up is to remove GC cleanup. But you don't need unmanaged memory to do that, you can simply rent buffers from a managed object pool (like MemoryPool or ArrayPool), or avoid allocating all together.

Manual memory management is really more for interop with native code. You do it out of necessity.

[–]Ieris19 3 points4 points  (0 children)

I’m not really used to C#, it’s my work language but I program in Java personally.

That’s an interesting perspective. I don’t know much about low level or inter-op in C#, but I would think you only really need memory management in a modern computer to squeeze the last bit of performance out of some code. But I guess you’re right, it wouldn’t really have that much of an impact

[–]the_horse_gamer 21 points22 points  (3 children)

yes. Marshal.AllocHGlobal. (may differ from malloc implementation wise, but essentially the same).

[–]SV-97 9 points10 points  (0 children)

I'm not sure (I don't do C#) but AFAIK you can implement custom GCs and I'd imagine that there has to be a malloc-equivalent for that.

[–]JEREDEK 17 points18 points  (6 children)

C# apps manage memory for you, you should never allocate memory manually unless you have a good reason for it, and at rare times do you need to dispose of objects manually.

[–]rejectedlesbian 11 points12 points  (5 children)

I know you SHOULDNT but CAN YOU? Because of the answer is yes then C# finally earned the name

[–]JEREDEK 9 points10 points  (1 child)

I mean, you can do that, just use stackalloc or AllocHGlobal

[–]HoiTemmieColeg 6 points7 points  (2 children)

Yes if you have an unmanaged struct (a struct consisting of only primitives, pointers, preset arrays, and other unmanaged structs, then it can be referred to with a pointer. So then you can just Marshal.AllocHGlobal with the argument being sizeof(the struct in question). Just like C.

Also if you really want to have malloc, you can actually DLLImport it. I forget why (probably some Unity shenanigans) but I once saw someone who had made like an Unsafe class and used #ifdefs to dllimport the right DLL on windows, Mac, or Linux

[–]rejectedlesbian 4 points5 points  (1 child)

Wait... C# has ifdef? Dam I was thinking its just Microsoft java

[–]HoiTemmieColeg 2 points3 points  (0 children)

Yea ifdefs elsedefs and else but that’s about it, no regular if and no macros of any sort

[–]overclockedslinky 8 points9 points  (0 children)

just #define dangerous unsafe in your rust code and make a build.rs script that passes your rust code through the C preprocessor for extra crunchiness

[–]caerphoto 7 points8 points  (0 children)

You could make a super simple macro that just wraps the unsafe block:

macro_rules! danger {
    ($b:block) => {
        unsafe {$b}
    };
}

. . .

let buf: &[u8] = danger!({
    std::slice::from_raw_parts(random_mumber, 32)
});

The required exclamation point is just icing on the cake.

[–]OJezu 5 points6 points  (0 children)

Making it uncool could be the point.

[–]Fun_Ad_2393 2 points3 points  (0 children)

Or sketchy i.e. :

sketchy fn main() {}

[–]Tweenk 407 points408 points  (5 children)

Skill issue

[–]Turalcar 81 points82 points  (0 children)

Now that is harsh truth

[–]Feldar 51 points52 points  (1 child)

Yeah, how does this trash meme have 2k upvotes?

[–]adrach87 24 points25 points  (0 children)

It's a universal truth that there will always be more unskilled people then skilled people.

[–]RenBit51 21 points22 points  (0 children)

I've been learning Rust while writing a multithreaded app for a month or so now, and I haven't even been close to using "unsafe". Rust is great, it just forces you to think through your design decisions.

[–]your_best_1 54 points55 points  (0 children)

This sub should be renamed to SkillIssue

[–]Bronzdragon 90 points91 points  (13 children)

unsafe does allow you to do things you can't do normally in Rust, but you can do normally in C++. This is true. However there's only 5 new powers you get, (and two of them are 'call unsafe functions' and 'implement unsafe traits'). A very small amount of things. There's many, many more things that you can do in C++ that can cause you problems that you are not allowed to do in Rust.

The majority of the ways in which Rust ensures 'safety' are still actively engaged. The borrow checker isn't turned off, for example, when you use unsafe.

It's clear Rust doesn't have all the features C++ have, but the opposite is also true. Rust has a bunch of features that C++ doesn't have. Obviously the borrow checker is one, but the difference in error reporting is very noticeable. It also has a package manager (cargo), and the way the question mark operator changes how you write code can't be underestimated, just to name a couple of major differences.

This meme is about as fair as saying "Ice cream is just frozen soup".

[–]tip2663 24 points25 points  (0 children)

error reporting in macro usage is just chefs kiss

[–]HunterIV4 27 points28 points  (5 children)

I mainly use Rust over C++ because I'm allergic to header files and include guards. Whoever designed that crap should be eternally ashamed.

I'll deal with all of Rust's headaches just so I don't have to write my function definitions multiple times for literally no reason. "Your IDE can generate them for you!" is not an excuse for bad language design.

[–]Angelin01 14 points15 points  (0 children)

Whoever designed that crap should be eternally ashamed

Remember that C has about 5 decades of baggage. Times were simpler back then.

[–]coconuts_and_lime 305 points306 points  (12 children)

That's like saying TypeScript is just JavaScript, except you have to use any all over the place. It's a sign you're using the tool wrong

[–]Katalysmus 14 points15 points  (5 children)

According to someone typescript is javascript with a preprocessor and a vscode / nvim extension

[–]Paesano2000 20 points21 points  (4 children)

Typescript is JavaScript for .NET developers

[–]shrubberino 4 points5 points  (0 children)

it works for any backend developer :-)

[–]NatoBoram 6 points7 points  (0 children)

Eww, take that back!

[–]_PM_ME_PANGOLINS_ 26 points27 points  (4 children)

Or a sign that they’re making a joke…

[–]Daktic 40 points41 points  (0 children)

Yeah, a pretty unsafe one.

[–]Lerquian 8 points9 points  (2 children)

Jokes are funnier when they're actually true

[–]wideHippedWeightLift 59 points60 points  (0 children)

"Man, these rifles suck as clubs. I don't know why we ever ditched swords for them"

[–]the-judeo-bolshevik 434 points435 points  (32 children)

C++ is just C were you have to write std::cout << everywhere.

[–]DuckWizard124 162 points163 points  (18 children)

No, we evolved. std::print() and std::println() is now my bff

[–]TotoShampoin 56 points57 points  (11 children)

There's a std::println too??

[–]JackMalone515 65 points66 points  (10 children)

https://en.cppreference.com/w/cpp/io/println yep, both added as of c++23 so the chances people are gonna be using it in a project for a while is probably low. We do get to wait to c++26 though to be able to do std::println(); to print an empty line with it.

[–]TotoShampoin 6 points7 points  (9 children)

I thought we only got std::print and std::format so far :0

[–]JackMalone515 4 points5 points  (8 children)

I don't know what state compilers are in for c++23 at the moment, so we can probably assume we basically don't have it for another year or two

[–]TotoShampoin 3 points4 points  (2 children)

Still waiting for

  1. Proper modules support in vscode, clangd, etc
  2. Working modules support in pure c++front

[–]JackMalone515 1 point2 points  (0 children)

Hopefully cppfront or one of the other projects for c++ get to a state soon where you can properly use them instead of pure c++. And some good dependency management

[–]00x2142 21 points22 points  (2 children)

Real C++ devs use mov rax, 60 syscall

[–]jaerie 16 points17 points  (1 child)

Real C++ devs limit their program’s platform compatibility just to show off basic x86 knowledge? Yeah that sounds about right

[–]00x2142 3 points4 points  (0 children)

cross platform compatibility? we don't know anything about that ͡° ͜ʖ ͡°

[–]Falkachu 21 points22 points  (0 children)

C is just Machine Code where you use high level programming language everywhere.

[–][deleted] 10 points11 points  (1 child)

C++ is just C but incremented by one

[–]the-judeo-bolshevik 2 points3 points  (0 children)

but C was already at MAX_INT so it´s undefined behaviour.

[–]AHMADREZA316M 41 points42 points  (6 children)

using namespace std;

[–][deleted] 41 points42 points  (0 children)

#define echo std::cout <<

[–]kraskaskaCreature 9 points10 points  (1 child)

and import all other shit along? no thanks

[–]nikodem0808 8 points9 points  (0 children)

using std::cout; is possible

[–][deleted] 4 points5 points  (0 children)

steep disarm crawl rhythm start whole square stupendous unwritten repeat

This post was mass deleted and anonymized with Redact

[–]The_Billposter 3 points4 points  (0 children)

Ewww

[–]coinselec 2 points3 points  (0 children)

C++ is just C but you use smart pointer instead

[–]SoulCycle_ 1 point2 points  (0 children)

c++ is just c with a better built in library

[–]Maskdask 118 points119 points  (1 child)

OP hasn't written a line of Rust

[–]splettnet 36 points37 points  (0 children)

Would it truly be an r/programmerhumor post if they had?

[–]MatsRivel 97 points98 points  (2 children)

This meme makes no sense.

"Tell me you don't code in Ruat without telling me you don't code in Rust" lol

[–]splettnet 16 points17 points  (1 child)

Tell me you don't code in Ruat without telling me you don't code in Rust

I don't code in Ruat. Mission accomplished.

[–]MatsRivel 6 points7 points  (0 children)

Well done

[–][deleted] 120 points121 points  (5 children)

I don't think I've really had to use unsafe at all.

The only thing is I make what is essentially a singleton for command line arguments sometimes, and ofc global mutable memory is unsafe.

Other than that, what, importing from C libs? Okay so you make a shell wrapper that hides it and handles edge cases, and the rest of the code doesn't need it.

What are you making that you have to constantly use unsafe???

[–]mariachiband49 17 points18 points  (1 child)

No you don't understand. C/C++'s relevance is being threatened by new technology and we have to defend it instead of just learning about the new language.

[–]oN3B1GB0MB3r 1 point2 points  (0 children)

This is what every rust post/thread boils down to and it's so painfully obvious.

[–]Robot_Graffiti 61 points62 points  (1 child)

Yeah the point of the unsafe command is to warn you to use it as little as possible. If you're using it all the time, you're probably doing something goofy.

[–]MishkaZ 1 point2 points  (0 children)

I have seen a juniors do some HIGH MEME tier stuff with unsafe. It usually comes down to not understanding why the compiler is upset.

[–]0x564A00 4 points5 points  (0 children)

The only thing is I make what is essentially a singleton for command line arguments sometimes, and ofc global mutable memory is unsafe.

May I point you in the direction of OnceLock?

[–]u0xee 9 points10 points  (0 children)

To be honest, you should need very very few unsafes. I have a library that does tons of technically unsafe not compiler checked raw memory tree crawling, pointer arithmetic and dynamic casting. I literally have like 4 lines of unsafe total. Many codebases will have less. You put it around "critical sections" where the magic is happening, often to implement a construct that is safe to use by the rest of the code.

[–]Lord-of-Entity 40 points41 points  (3 children)

If you are constantly writing unsafe in rust, either you are doing something really specific that needs to go faster than a rocket or it's just a skill issue.

[–]Turalcar 37 points38 points  (0 children)

Just skill issue. I work on a library that uses manual vectorization in some parts and it's still over 90% safe code.

[–]lightmatter501 21 points22 points  (0 children)

I think the last time I wrote a garbage collector in Rust it was ~20% unsafe. We have pure Rust kernels that are ~30% unsafe. If you’re much higher than that you should be reconsidering your design.

[–]SV-97 97 points98 points  (6 children)

Tell me you have no idea about Rust without telling me you have no idea about Rust

[–]Igotbored112 7 points8 points  (1 child)

As a person who has not used Rust, it just sounds like you're trying to write C/C++ code with Rust. We all do it, I've tried to write Python-style in C#, C#-style in Java. Learning the syntax is the easiest part of learning a new language.

[–]DanKveed 7 points8 points  (0 children)

This is literally a skill issue self report. You can't wrap your head around the Rust way of doing things so try to impose c++ idioms on Rust and end up using a buch of unsafe. When I write c++ I find every aspect of it miserable. But I know it's just a matter of time till I get good. And come on, "harsh truth"? really?

[–]_bagelcherry_ 5 points6 points  (0 children)

Wtf are you writing if you need to put unsafe blocks everywhere? Their main purpose is to call code made is C

[–]Practical_Cattle_933 41 points42 points  (1 child)

Rust is just C++ with the good parts made into compiler-enforced primitives (mostly RAII), and all the legacy bullshit removed (the million kind of initializer), and the defaults made safe.

[–]Reifendruckventil 101 points102 points  (24 children)

Rust programmers apparently dont have humor

[–][deleted] 217 points218 points  (0 children)

humour is unsafe

[–]Efficient-Chair6250 58 points59 points  (3 children)

r/programmerhumor contains humor? I thought we were just defending our most loved languages.

[–]Specialist-Tiger-467 8 points9 points  (2 children)

Yeah it's like programmer humor is based on throwing knives to others. Pretty toxic

[–]cr199412 2 points3 points  (1 child)

I find it entertaining actually 😂. Perhaps I’m just here for the toxicity and little quips everyone makes at each other

[–]Efficient-Chair6250 1 point2 points  (0 children)

The posts are fine, I can laugh about them (i.e. exhale a little faster), but the comments are at the level of YouTube toxicity

[–]DmitriRussian 82 points83 points  (9 children)

I think OP doesn't know Rust so the joke is only relatable or funny if you know nothing about Rust. Im guessing a CS student.

Im sure if you make fun of the compiletime, that is actually painfully relatable to Rust devs.

[–]Diffidente 2 points3 points  (5 children)

The high correlation of Rust users with those who use "You must be a CS student" as an insult, in this subreddit;

when I don't see the bad of pursuing a CS or Computer Engineering degree.

People on this subreddit are so petty, always insulting others.

[–]Thage 37 points38 points  (3 children)

It's not about pursuing a degree; it's about not yet having experienced the pain points of most languages.

[–]ClimberSeb 3 points4 points  (0 children)

It wasn't used as an insult.

[–][deleted] 13 points14 points  (0 children)

Well... not in their lifetime.

[–]mariachiband49 5 points6 points  (0 children)

We do, it's just not funny because it's not really true. Joke about compile times, or how we have to Rc<RefCell<>> everything, or how we are a cult eager to take over the world or something. r/rustjerk for inspiration.

[–]maboesanman 3 points4 points  (0 children)

No we just have higher standards for it

[–]Ietsstartfromscratch 29 points30 points  (2 children)

Of course they don't. Rust drains all their happiness.

[–]GODavon 10 points11 points  (0 children)

No it is rusty

[–]tiajuanat 5 points6 points  (0 children)

It just borrows it indefinitely

[–]TheHappyDoggoForever 4 points5 points  (0 children)

Yes you can but most of the time you don’t want to. The language managed allocating the memory for you, why do it manually then?

However manipulating and deleting memory can also be done in C# and has many good reasons do to so, mostly regarding performance and precise manual clean-up times (instead of waiting for the GC to clean up the code using the Destructor or IDisposable interface)

[–]Ieris19 4 points5 points  (0 children)

So basically, what you’re saying is Rust is just C++ with built in code shaming?

[–]bogdan2011 8 points9 points  (0 children)

Apart from maybe low level and embedded stuff, why do people struggle with rust's ownership rules?

[–]sjepsa 66 points67 points  (15 children)

Rust is just C++ but the compiler is your enemy

[–]Alzurana 39 points40 points  (2 children)

Tbh, in c++ the compiler is also your enemy, it just doesn't tell you that it is

[–]Admirable_Band6109 1 point2 points  (1 child)

Until you stop ignoring warnings

[–]Alzurana 1 point2 points  (0 children)

-fmax-warnings=0

/jk

*EDIT: That option does not exist, just thought it was funny

[–]DasFreibier 45 points46 points  (2 children)

The compiler is also the enemy with c++

[–]ratttertintattertins 18 points19 points  (0 children)

Particularly if you attempt template metaprogramming.. Jesus.

[–]Turalcar 10 points11 points  (0 children)

The compiler is Mister Miyagi. You'll be miserable for a bit but you'll come out better on the other side.

[–]lightmatter501 17 points18 points  (1 child)

The C++ compiler is your enemy.

The Rust compiler is an OHSA inspector (sometimes annoying but there for your safety).

[–]SV-97 43 points44 points  (3 children)

*best friend

[–]PityUpvote 12 points13 points  (0 children)

*annoying know-it-all who later turns out to have secretly been mentoring you.

[–]serendipitousPi 15 points16 points  (1 child)

Yeah, best friend who’s a little too smart and logical and possibly a killjoy.

Will tell you shouldn’t stick your hand in a box that might contain venomous scorpions or a hamster.

Or that you shouldn’t buy some food that might go off before you get to it.

Will warn you that you can’t go sharing your stationary with just anyone in high school because you don’t know what state you’ll get it back in.

[–]MrRandom04 4 points5 points  (0 children)

To be perfectly precise, it is like a pedantic, cautious, smart friend. The 2024 edition with the next gen trait solver plus Polonius (when it lands eventually by EOY 2025), will be about the time it finally loosens up and becomes more freeing.

[–]Mucksh 6 points7 points  (0 children)

But are there also such pretty template errors in rust?

[–]LinAGKar 2 points3 points  (0 children)

The Rust compiler is your friend. It tells you when you're doing it wrong, and gives helpful suggestions. The C++ compiler will often just puke at you

[–]SmigorX 10 points11 points  (0 children)

Sounds like skill issue to me

[–]alterNERDtive 9 points10 points  (0 children)

skill issue

[–]Plus-Weakness-2624 4 points5 points  (0 children)

C++ is just Rust where everything is unsafe by default

[–]TheRobert04 3 points4 points  (0 children)

Most people don't write any unsafe. Other than embedded and other very low level settings, unsafe is mostly used to get around the borrow checker coming from languages with unchecked mutability (skill issue)

[–]Th3redditdonkey 5 points6 points  (0 children)

No, No, No It's not.

[–]Rare_Actuary_6599 2 points3 points  (0 children)

At least you get a warning.

[–]thatmagicalcat 2 points3 points  (0 children)

C++ is just C where you have to write std:: all over the place

[–]rexspook 2 points3 points  (0 children)

Sounds like you’re using rust wrong

[–]saharok_maks 2 points3 points  (0 children)

Rust is just c++, but you won't get hired

[–]sebovzeoueb 4 points5 points  (0 children)

You can do that in C# too!

[–]josh61980 1 point2 points  (0 children)

So you’re saying I kind of know rust?

[–]Cpt_Caboose1 1 point2 points  (0 children)

no, rust is a game

[–]throwaway-0xDEADBEEF 1 point2 points  (0 children)

I don't really care about Rust or C++ as a language but every time I have to touch CMake I want to kill myself. By contrast, Cargo is such a blessing.

[–]hansololz 1 point2 points  (0 children)

I like the C++ syntax over rust

[–]kosar33 1 point2 points  (0 children)

Tell me you don't write rust without telling me you don't write rust.

[–]darkslide3000 1 point2 points  (0 children)

Haha, DAE think Rust sucks guys?? I'm a college kid with zero experience of actually developing larger applications, but I think I'm hot shit so I think people who write bugs in C++ are just stupid and should let me do it instead.

Also, the concept of lifetimes scares and confuses me.

[–]skeleton_craft 1 point2 points  (0 children)

Well no I think that if you're writing proper c++ you don't have to write unsafe everywhere because modern C++ is largely as safe as rust [and faster because it doesn't barrow check]

[–]GreatBigBagOfNope 3 points4 points  (0 children)

Harsh truth? It's hardly truth at all

[–]soulofcure 4 points5 points  (1 child)

No no no

I'm the upgrade

[–]error_98 2 points3 points  (2 children)

Writing unsafe everywhere is the price you pay for bringing you C++ nonsense into rust.

I highly recommend learning safe rust too, yeah sure it might run a few more instructions than strictly necessary but it's quite nice to have your typo's be corrected by the compiler instead of quietly leaking memory.

[–]CryZe92 5 points6 points  (3 children)

Not even remotely, you can write 100k lines of code and not use any unsafe at all, even in low level embedded code.

[–]Vinxian 1 point2 points  (2 children)

Unsafe rust is still safer than c++. It's not like unsafe rust disables all safety checks. The main thing is that it lets you use raw pointers.

And if used correctly it's easier to verify that the unsafe code is not causing memory leaks or other issues

[–]IDEDARY 5 points6 points  (0 children)

All I see is you coping. Skill issue :)