The thread everyone waited for. Tell me why C fags are so jealous?

The thread everyone waited for. Tell me why C fags are so jealous?

Attached: rust.png (1200x1200, 56K)

Other urls found in this thread:

doc.rust-lang.org/std/iter/trait.Iterator.html
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1000657
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1000810
twitter.com/NSFWRedditVideo

good doc generation tool (doxygen is nightmare)
namespaced enums
no implicit integer promotion
no errno

that's pretty much all

Please try again later when the cfags get off work. There's something maybe they miss being unemployed, thus having abundant free time to no effort weak troll. Time to waste on meme languages and gay sex with mentally ill men who think they are women. Probably jelly of the cuddling afterwards before being stabbed and called a nazi then being begged not to leave.

>ctards
>work
Do you live in a bubble?

>obsessed with gay people
Oh I see.
Also, rent free.

Attached: 1550442694101.png (1022x1030, 120K)

Rust is the comfiest language I've ever used

Rust fags in this board.

Attached: 39227174_1918547691537299_6713858994110201856_n.jpg (798x960, 64K)

>Tell me why C fags are so jealous?
Rent-free

Attached: 1550250398554.png (500x562, 231K)

I'm starting to learn it .The syntax is a little off-putting and trying to keep up with all the member functions is a little overwhelming. Some of the rules around stuff like ownership still confuse me. I figured I'd understand it pretty intuitively since I've worked plenty in C and C++ but I don't understand why you can't just do the following for string concatenation.
let x = "wew";
let y = "lad";
let z = x + " " + y;


I'm mostly interested in Rust's functional aspects but I can't find a good source of examples of how you even use things like map and filter without getting compile errors. I wish the language had HKT's but it has quasi-typeclasses like Haskell which is really nice. I'm sure it will be easier to program once I understand all the rules and know the basic functions for actually creating strings.

Also how the hell do strings work? I've heard they use UTF-8 by default so I'm guessing it's not as simple as a vector of bytes like in C++.

Attached: 1517581008171.jpg (960x536, 36K)

>I don't understand why you can't just do the following for string concatenation.
For basically same reason you can't do it in C: it would require a heap allocation, and Rust tries to avoid making those happen implicitly.

>Also how the hell do strings work? I've heard they use UTF-8 by default so I'm guessing it's not as simple as a vector of bytes like in C++.
It's a vector of bytes like in C++, except the bytes must be valid UTF-8.

let x = "wew";
let y = "lad";
let z = [x, " ", y].concat();

java does this better

I can understand wanting to avoid implicit memory allocation. I suppose that's also why the get_line function requires a mutable string rather than returning a string. But I'm guessing in the latter example they see having creating an array and concatenating it to be more explicit memory generation?

Also, how do iterators work. In C++ I remember they were basically just any container with an object that implemented an overloaded (++) operator to get the next element. Is there something similar in Rust?

Attached: 1548632493454.png (146x254, 68K)

idk what C programmers do to rustle the jimmies of Rust trannies this fucking hard, but damn son we have this thread every day.

>But I'm guessing in the latter example they see having creating an array and concatenating it to be more explicit memory generation?
Well, I personally wouldn't mind +, but some purists think that + should only mean add in the mathematical sense, or some shit like that. I think there was discussion at some point about adding a concatenation operator to Rust, but it never got anywhere.
>Also, how do iterators work. In C++ I remember they were basically just any container with an object that implemented an overloaded (++) operator to get the next element. Is there something similar in Rust?
You gotta implement the Iterator trait bro.
doc.rust-lang.org/std/iter/trait.Iterator.html
Oh. I see what you did there. Now you EXPOSED the shitty Iterator page that's like a 100 megabytes and loads like molasses.
So yeah.
> good doc generation tool
bullshit

Rust attracts autists who like to get obsessed with one thing, and shill it to no end

>good doc generation tool (doxygen is nightmare)
Sphinx + kernel-doc. You can thank me later.

>Feeling the need to make post that image
Rent-free

Attached: 1550639396959.jpg (640x736, 42K)

format!() makes it easy and it keeps things consistent with println!()
let z = format!("{} {}", x, y);

Oh god why. Just format!("{} {}", x, y) like a normal person.

>Also, how do iterators work
The Iterator trait defines a method next() that returns the next thing in the sequence, or None if there's no more stuff. The for-loop desugaring goes about like this:
for x in collection.iter() {
// do stuff
}

desugars to
let mut it = collection.iter();
while let Some(x) = it.next() {
// do stuff
}

which in turn desugars to
let mut it = collection.iter();
loop {
match it.next() {
Some(x) => {
// do stuff
},
None => break,
}
}


There's an additional wrinkle in that you can actually iterate over anything that implements FromIterator, not just Iterators themselves. So you can write `for x in collection` and it will automatically convert that to `for x in collection.into_iter()`.

Haha, very true, fellow Rustacean! As you can see on the chart, Rust scores much bett-

Oh wait

Are you proud of me?
int isprime(int n) {
int max = n / 2;
int i;
if (n == 1) return 0;
if (n == 2) return 1;
if (n % 2 == 0) return 0;
for (i = 3; i < max; i++) if (n % i == 0) return 0;
return 1;
}

>figures from Indeed
>popularity from StackOverflow
with those in mind, yeah the graph is exactly as to be expected

Lmao why is this so much faster than int isprime(int n) {
int max=n/2;
int i=!0;
if (!(n^1)) return 0;
if (!(n^2)) return 1;
if (!(n%2)) return 0;
while ((i+=2)

OH FUG this isn't /dpt/. Sorry guys.

Attached: file.png (1368x717, 38K)

.unwrap().unwrap().unwrap().unwrap()

Literally better than exceptions.

How is it better? An exception can be gracefully handled, unwrap will literally make your program shit the bed.

Uncaught exceptions don't gracefully end. Rust explicitly forces error handling too

Why rust over go or d

>Noooo Cniles have jobs because rustfags don't reeeeee
Your typical ctard logic. Can't spell Cope without C

You can add strings in C++ just fine and in all other languages newer than C

document.write("2" + "3");

Well, that's news to me.
It's news to the g++ devs as well, by the looks of it

Attached: add.png (1188x109, 18K)

String constants are by default const char arrays. The std::string overloaded (+) function has versions for appending with const char arrays. However, this requires that a string be one of the lvalues.

int main() {
std::cout

fn is_prime(p: u64) {
(2..p).take_while(|&k| k * k

Attached: smug wojak rust.png (767x639, 109K)

Rust is such an objectively _ugly_ language

Who designed it lol

Not some old Cnile boomer for sure.

Attached: segfaulting cnile.png (627x722, 114K)

At least C is relevant

Based
Redpilled

C is a niche

>13.7MB page
wtf why's it so big for?

Perhaps so, but that 'niche' is literally everything of any relevance.

Yes. Every relevant security exploit.

Attached: goofy cnile.png (1799x825, 263K)

OCaml hackers who were gazing lovingly out the window at C++ from the privacy of their own home when without warning the Haskell community put its hand over their mouth and hiked up their skirt and the rest is history

>suck my tranny CoC

That's not why, it would work fine if x were a String despite being an "implicit" heap allocation. The reason is to discourage short-lived owning temporaries like x + " " would be in favor of accumulating into one String object.

And string constants in Rust are by default &'static str slices. A String has an overloaded Add impl that takes a slice.
fn main() {
println!("{}", String::from("1") + "2");
}

Utterly based

>daily rust shilling thread
If you have to shill it so hard here, you already know it's garbage.

Rent free

>user shills C
It's ok
>user shills Rust
Hurr durr shill

For all the shit Apple gets. Swift is the Rust we've all wanted.

>no ++ and -- operators because it's too hard for people
i don't know about that

int i;
i = 12;
printf("%i", ++i + ++i++ - i++ -- -i + --i*--i--++);

What does it print?

NOOOOOOOOOO
You are using it wrong

Attached: 1544729016111.png (1098x1126, 492K)

13 + 14 - 15 - 15 + ( 14 * 13 ) = 179

Yea, no Ctard. It's a compilation failure.
Fucking retard. GTFO, you don't even know what you use.

It is indeed too hard

Attached: Screenshot from 2019-02-27 18-56-52.png (3838x690, 164K)

I'm not sure what point you're trying to make, it's literally UB you're triggering, that doesn't mean it's too hard for a typical use case.

Rust trannies should be hunted down and euthanized.

Unfortunately, "typical use" has absolutely no meaning.

>they made another read-only language
wew

trannie cuck language

>lamdas are bad
>function pointers are okay

Attached: C grugs.png (1200x699, 345K)

OBSESSED

>being smug about an inefficient implementation
wew lad

You with CoCks, yeah

Nice living rent free in your head.

Attached: 1549755834302.jpg (425x283, 18K)

no software of any importance is written in rust.
that's all that needs to be said.

It literally has the same execution time as the naive imperative way (at least with level-3 optimization).

Attached: 1549351819176.gif (480x292, 1.99M)

ЯIIR

yeah I already said it's inefficient

yes yes we know you can do a sieve

I guess something more complex than simple iteration was too complex to implement in rust huh

thanks I guess

Attached: c-rust-rewrite.png (600x382, 163K)

Rav1e and web renderer

obsession

>idk what C programmers do to rustle the jimmies of Rust trannies
Basically Rust fags are Ruby fags who are convinced they invented something great, and tried to get C and C++ on board. C programmers shrugged and ignored them, while C++ programmers laughed and mocked them.

Rust fags are not competent programmers, so they beg other people to adopt their shitty language instead of demonstrating how good it is.

these posts are so cute

> C programmers shrugged and ignored them, while C++ programmers laughed and mocked them.

Attached: Screenshot_2019-02-27 John Carmack on Twitter I'm still completely in the excited-newbie honeym (640x342, 37K)

I think I will stick to the language family which has had compilers optimized for it since 1969, have a nodev day tranny

LLVM is very good at optimizations these days

>Be C fag
>Try Rust because you want to avoid buffer overflows in your program
>Your new "safe" language actually has integer and buffer overflows in its standard library
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1000657
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1000810

In Rust, bufferoverflow is a bug
In C, bufferoverflow is a feature

>private ownership of resources
Rust is ironically based and redpilled

kys tripfag

This is absolutely unbased, cringe and bluepilled

why leave your trip on when you chop your dick off

My dick seems to be living inside your brain rent free. I knew it liked your head the first time it went through your mouth.

based
redpilled
ironpilled

I don't understand why .NET is so low when it's used mostly for the same shit as Java. I'm guessing Java takes into Android as well?

Carmack is a suckless

Attached: Screenshot_20190227-085455_Lightning-01.jpg (715x1205, 330K)

>implying Eratosethenes' sieve is impressive
>implying k * k

why is this framed as rust vs c when its not competing with it?
Rust is competing with Go and Node for the web space.

because Rustfags are actually deluded enough to think that Rust can fully replace C

nice guy, he answered my mail, duno if it was a bot or an assistant but got the repply

Can't see why not, C++ already replaced C in most cases.

Rust has assembly, interfacing with C and all the pointer shit C has. The only reason it won't replace it is muh appeal to tradition.