[ / / / / / / / / / / / / / ] [ dir / 2hu / animu / asmr / cafechan / rule34 / tk / u / zoo ][Options][ watchlist ]

/tech/ - Technology

You can now write text to your AI-generated image at https://aiproto.com It is currently free to use for Proto members.
Name
Email
Subject
Comment *
File
Select/drop/paste files here
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Expand all images

File (hide): 0b1df90eb319554⋯.jpg (9.03 KB, 250x241, 250:241, 51fYzbYoXFL._UX250_.jpg) (h) (u)

[–]

 No.855881>>856113 >>858203 [Watch Thread][Show All Posts]

Discuss why C++ is superior to other languages and showcase your latest C++ projects.

Trolls and pajeets not welcome.

 No.855884>>855895 >>856297 >>859157

>I find C++ quite ugly.

>The flaws of C++, as I recall from when I studied the matter around 1990, include syntax and semantics. As for syntax, its grammar is ambiguous, and it is gratuitously incompatible with C, which blocks the smooth upgrade path from C to C++.

>As for semantics, the abstract object facility of C++ is designed around the case where the real type of an object is known at compile time.

>However, in that case, abstract objects are equivalent to a naming convention for functions to call.

>The case where abstract objects add real power to a language is when the type is not known until run time. C++ does handle that, but it seems to be an afterthought, a poor relation.

>I suspect that I would find plenty of ugliness in the template library, but I don't know. That was added to C++ after I studied it.


 No.855885>>855895

File (hide): 35f14dfe2faa89e⋯.png (283.56 KB, 640x522, 320:261, install_c.png) (h) (u)

It's unsafe and has high mental tax with each line written


 No.855889>>855895 >>855896 >>855933 >>856120 >>856122 >>856301

Let's talk about rust fam :

> safe

> faster than C++

> beginner-friendly, even Ruby developers can do it.


 No.855895>>856177

File (hide): ebc18414991b7c4⋯.jpg (6.13 KB, 238x307, 238:307, 14819950035362.jpg) (h) (u)

>>855885

>>855884

>>855889

Stay in your containment thread rustfag


 No.855896>>855962

File (hide): 942eb00960e1ac6⋯.jpg (65.13 KB, 570x960, 19:32, femme.jpg) (h) (u)

>>855889

Rust shilling is a cuck/g/ thing, friendo. You stick out like a sore thumb, and you probably look like one in real life.

Also

>fam

Get the fuck out


 No.855898

muh Ada xDD

muh D xDDDD


 No.855933

>>855889

>faster than c++

hahahahah sure

c++ has the most sophisticated compiler ever consistently doing better than everything else rust is not gonna beat it so soon.

c++ is likely not fundementally much faster but sooooo much work has gone into micro optimizing it


 No.855962

>>855896

you're way off fam


 No.855970>>855975 >>856117 >>856143

File (hide): 2c10eade9b1697c⋯.jpg (264.76 KB, 600x437, 600:437, ebin pepe .jpg) (h) (u)

it provides the biggest toolset without trading off real-time performance, and lets you do things that most other languages dont like meta-programming (advanced stuff, not just type templating).

The only complaint I got is some of the tooling ecosystem.

For example dependency management was something that only recently was tackled in acceptable quality with https://www.conan.io/.

We're still stuck with shitty CMake for the most part for a cross platform project generator. There are other alternatives but I didn't find them mature enough yet.

Future C++ standards seems very promising, with things like more advanced code generation (Herb's CppCon2017 talk), better TMP (concepts), and so on.


 No.855975>>855980 >>855981

>>855970

Why doesn't it have reflection?


 No.855980

>>855975

it wasn't standardized so far.

Reflection can be both run-time and compile-time.

AFAIK most languages that have reflection do it at run-time.

For C++ usually it was up to the programmer to implement it.

In Herb's talk he describes a static introspection (more than just reflection) system, which is really cool:

https://www.youtube.com/watch?v=4AfRAVcThyA


 No.855981

>>855975

Because the reflection proposal ( http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0194r4.html ) hasn't been added to the standard yet?


 No.855983

It's easier to list features that C++ doesn't have than the ones it has. And this isn't a good thing, especially for a shitty hack on top of C.


 No.855984>>855997

C++ is like silicone putty, you can mold anything with it, but using it to metaphorically build a skyscraper instead of using concrete rebar means you need a train load of code.


 No.855997

>>855984

fallacy.

Hardcoding libraries into a language standard doesn't mean you can't use 3rd party libraries in languages that don't.

At best it's a trade-off between having a bloated language vs adding libs to a project.


 No.856113>>856136

>>855881 (OP)

Does it have stable ABI yet?

Does it have the official standard available freely?

Do changes in a class implementation still require recompilation of the code which uses this class via its interface?


 No.856117>>856133 >>856869 >>856879

>>855970

>meta-programming (advanced stuff, not just type templating).

it's not metaprogramming dude, it's a horrible abuse of templates.

proper metaprogramming is when the code is almost as straightforward as usual code, that means its intent is not obfuscated. a good example is LISP, and Clojure in particular. TMP on the other hand is a special olympics started after the discovery that templates were accidentally turing complete.

but maybe recent standards do improve on that?


 No.856120

>>855889

not sure about the 2nd point, but 1 and 3 are complete bullshit.

it's been proven to have UB in "safe" subset.

and fighting with borrow checker is not for everyone, and certainly many "Ruby developers" won't be able to master that.


 No.856122>>857556 >>857624

>>855889

>> beginner-friendly, even Ruby developers can do it.

a glaring example is the following:

in an AoC thread, every day there were solutions posted in many languages, including Rust. then came the day with a problem which requires handling of tree data structure (or graph, don't remember exactly). for some reason there were no Rust solutions posted on the same day for this problem.


 No.856133>>856141

>>856117

How would you design a C++ meta programming syntax that is also backwards compatible to the C language?


 No.856136>>856151 >>858969

>>856113

>Does it have the official standard available freely?

No, but the working drafts are about just as good.


 No.856141>>856144

>>856133

>How would you design a C++ meta programming syntax that is also backwards compatible to the C language?

Oh fuck off. C++ people bitch all the time about how backwards compatibility with C makes C++ worse (macros, arrays, preprocessor are all evil go figure) until someone dares suggest improving the language and then backwards compatibility with C becomes good and important again... in the same language that deprecated C's standard header filenames back in 1998. Just fuck off, really.

So I'll answer your idiotic question by asking an idiotic question of my own: how exactly is the current metaprogramming syntax backwards compatible with C seen how the template, typename, class keywords don't exist in C to begin with?


 No.856143

>>855970

>We're still stuck with shitty CMake for the most part for a cross platform project generator. There are other alternatives but I didn't find them mature enough yet.

What about SCons?


 No.856144>>856152

>>856141

The point of the C++ template syntax is so that there is no ambiguity in which parts are related to template programming. C++ was a language designed so that people can take C code and just plop it into the C++ code and C++ compiler. They needed a way to provide the template metaprogramming facitility on top of all this.


 No.856151>>857370

>>856136

You could simply answer "No"---I didn't ask for excuses.

And what about the other 2 questions?


 No.856152>>856157 >>856176 >>856205 >>856220 >>857370

>>856144

Hi, I'm a piece of C code which you need to compile as C++.

I have a thousand or two functions, variables and typedefs named 'template', 'typename', 'class', 'operator', 'abstract', 'virtual', etc. hope you get the idea.


 No.856157>>856171

>>856152

>im retarded, pay attention to me

No.


 No.856162

So when (if ever) will C++ become memory safe?

Is it even possible?


 No.856171>>856172

>>856157

If you have nothing to say, it's better to keep silent.

You are the reason why /tech turned to shitposting party. Please, go back to reddit.


 No.856172

>>856171

/tech/ has always been a shitposting party. The reason for that is quite simple: Underage NEETs don't know anything about technology. They only know their anime, vidya and browsers.


 No.856176>>856189

>>856152

no one names their variables and functions after keywords you dumbo


 No.856177>>856179 >>856188

>>855895

Not an argument.

C is the patrician language.


 No.856179>>856297


 No.856188>>856297

>>856177

s/trician/jeet/


 No.856189>>856194

>>856176

they are not keywords in C you dinghole


 No.856194>>856259

>>856189

>needing to compile c code as c++

no u


 No.856205

>>856152

So there's a keyword conflict. That doesn't change the design goals of C++.


 No.856220>>856226

>>856152

>having such shit forethought as to name things in C with C++ reserved keywords

Get out pajeet, /tech/ is a white supremacist board.


 No.856226

>>856220

show some code you wrote or gtfo stupid nazi LARPer.


 No.856259

>>856194

this is what that guy initially used as an excuse for C++ ugliness. I therefore demonstrated that it's bullshit and doesn't work too.

of course I don't need nor want to do such stupid things as compiling code written in one language as another which is not backwards compatible.


 No.856269>>856270

File (hide): ec22ad364897759⋯.jpg (67.84 KB, 549x483, 183:161, phones.jpg) (h) (u)

Can anyone tell me why I would need to write in anything more modern than C++98 (/C++03) ?


 No.856270>>856273

>>856269

Later standards make the language a joy to use


 No.856273>>856276 >>857232 >>857255 >>857324 >>857370

>>856270

Do they make it memory safe though?


 No.856276>>856278 >>856310 >>857232 >>857255 >>857324

>>856273

Just don't use raw pointers and you'll be fine.


 No.856278>>856281 >>856291 >>856318 >>857188 >>857370

File (hide): 5d62dddd5ede42b⋯.png (6.54 KB, 255x255, 1:1, hmmm.png) (h) (u)

>>856276

std::vector v;
v.push_back(MyObject);
for (auto x : v) {
v.clear();
x->whatever(); // UB
}

hmmmmmm...


 No.856281>>856282

>>856278

>let me just write wrong code on purpose that will show them


 No.856282>>856293 >>856315

>>856281

>wrong code

It compiles and it doesn't use raw pointers


 No.856291

>>856278

>it doesn't use raw pointers

>uses dereferencing arrow on object

Just stop.


 No.856293>>856308

>>856282

Here's your last (You). Deleting containers that you loop through is not something you ever do. It's programming 101. Now you can be happy that you baited all of us but please kindly fuck off.


 No.856297

>>856179

What should I be looking at?

>>856188

Go tell that to RMS >>855884 , faggot.


 No.856299

Trick is to write what CAN be optimized

and for that C++ is great

A lot of others try to do things that nobody sane would want or need


 No.856301

File (hide): 56bc2356832b2bb⋯.jpg (57.2 KB, 381x499, 381:499, rust_programming.jpg) (h) (u)

File (hide): 9f2a8c8d931da4d⋯.jpg (173.23 KB, 1110x837, 370:279, rust_homosexuals_vs_C _el….jpg) (h) (u)

>>855889

Kill yourself faggot


 No.856308>>856313

>>856293

>claims that c++ is memory safe as long as you stay away from raw pointers

>gets BTFO by a minimal example

>LOL just dont do that

ok kid


 No.856310>>856313 >>856318 >>857370 >>858190

File (hide): b12bd1e6ae2b9c2⋯.png (45.79 KB, 680x680, 1:1, hmmm 2.png) (h) (u)

>>856276

class Foo;

unique_ptr<Foo> inst;

class Foo {
public:
virtual void f();
void kaboom() {
inst = NULL;
f(); // UB if this == inst
}
};

hmmmmmmmmmmmmmmmmmmmmm...


 No.856313>>856314

>>856308

Are you kidding? His "minimal" example makes no sense because he doesn't define a type for the vector.

But he then dereferences the object... despite claiming it's not a pointer...

Even if he hadn't fucked up the example it's not UB and in fact runs just fine. He just doesn't understand range based for loops.

Goddammit there should be like a short programming test instead of Captcha to keep all the retards away from /tech/

>>856310

I can't even tell if I'm being trolled any more.


 No.856314

File (hide): 8b83657a2083df2⋯.gif (134.65 KB, 1090x628, 545:314, merchant damage control.gif) (h) (u)

>>856313

>maximum damage control

WEW lad. It is so easy to spot you glow in the dark CIA niggers.


 No.856315>>856316 >>856317

File (hide): e833ceb0e92a8f0⋯.jpg (77.08 KB, 887x1097, 887:1097, 12349189191684.jpg) (h) (u)

>>856282

>it compiles

>it compiles

>it compiles

>it compiles

>it compiles

The absolute state of rust shills


 No.856316>>856318 >>856323

File (hide): 80f5f4fd3c8ee2e⋯.jpg (181.87 KB, 732x746, 366:373, emma roberts laughing.jpg) (h) (u)

>>856315

>desperately trying to detract from the fact that modern c++ isn't memory safe

>desperately trying to detract from the fact that modern c++ isn't memory safe

>desperately trying to detract from the fact that modern c++ isn't memory safe

>desperately trying to detract from the fact that modern c++ isn't memory safe

>desperately trying to detract from the fact that modern c++ isn't memory safe

>desperately trying to detract from the fact that modern c++ isn't memory safe

The absolute state of LARPers


 No.856317>>856319

>>856315

Except it doesn't compile.


 No.856318>>856321

File (hide): d62e6bb92e4c5a7⋯.png (347.73 KB, 850x647, 850:647, 1484888053040.png) (h) (u)

>>856278

>>856310

>>856316

>"LOOK AT MY EXAMPLES OF WHY C++ IS BAD"

>point out examples are broken and don't compile

>"LMAO C++ IS SHIT I WIN THE ARGUMENT LELELELE RUST IS THE BEST

you can't be serious


 No.856319

>>856317

>post points out it doesn't compile

>anon points out the example doesn't compile

Thanks captain obvious?


 No.856321>>856323

File (hide): caba64945e33c53⋯.jpg (298.93 KB, 869x1024, 869:1024, laughing whore.jpg) (h) (u)

>>856318

>IM NOT MAD!!!! MY KEYBOARD IS BROKEN THAT IS WHY I WRITE IN ALL CAPS! ALSO MUH RUST!!!!!!!!!!!!!!!!!!

>IM NOT MAD!!!! MY KEYBOARD IS BROKEN THAT IS WHY I WRITE IN ALL CAPS! ALSO MUH RUST!!!!!!!!!!!!!!!!!!

>IM NOT MAD!!!! MY KEYBOARD IS BROKEN THAT IS WHY I WRITE IN ALL CAPS! ALSO MUH RUST!!!!!!!!!!!!!!!!!!

>IM NOT MAD!!!! MY KEYBOARD IS BROKEN THAT IS WHY I WRITE IN ALL CAPS! ALSO MUH RUST!!!!!!!!!!!!!!!!!!

ok


 No.856323>>856325

>>856316

>>856321

so how do you explain that your examples don't work?

is that just because c++ is bad?


 No.856325>>856329 >>856870

>>856323

so how do you explain that c++ isn't memory safe?

is that just because c++ is bad?


 No.856329>>856331

>>856325

>c++ is bad

i think you're just bad at c++


 No.856331>>856332

>>856329

>only bad programmers write imperfect code

ok dude. i'm sure you have a perfect track record. but have you actually done more than hello world/fizzbuzz?


 No.856332>>856334 >>856380

>>856331

ok dude how about you just own up to the fact that neither of your examples compiles?

give us some working examples where you showcase c++s flaws and then we can continue the discussion because as of now you're just stalling.


 No.856334>>856380 >>856398 >>856427

>>856332

>c++ isn't memory unsafe

https://www.cvedetails.com/vulnerability-list/

<those are all bad programmers

<real programmers don't write memory unsafe code

ok kid


 No.856380>>857152

>>856332

>your examples don't compile

>>856334

>>c++ isn't unsafe

Who are you quoting?

>completely ignore what the post said

Fucking leave, InaneBob.


 No.856398

>>856334

>cve vulnerabilities

Surely c++ is to blame for every documented problem with all known software. Which has other implications... including admitting irrelevancy for whatever you are shilling.


 No.856427

>>856334

Why are you talking about c++ being memory unsafe when all the posts talk about your examples not compiling?


 No.856869>>856890

>>856117

>t. someone who never wrote TMP in his life and parrots things other people says.

> (LISP))))))()(>(readable))))))()()()))(((()))))))))))))))))()))))))))))))))))))))))

TMP code is straight forward and simple. there's nothing complicated about things like std::enable_if<bool>, it's merely overloading/specializing functions.

The real downside is debugging, which is something the Concepts proposal suppose to solve.


 No.856870

File (hide): ae2f5ff502afeda⋯.jpg (58.02 KB, 680x646, 20:19, pajeet.jpg) (h) (u)

>>856325

>t. pajeet who never heard about std::unique_ptr and std::shared_ptr in his C with Classes web seminar.


 No.856879

>>856117

>proper metaprogramming is when the code is almost as straightforward as usual code, that means its intent is not obfuscated. a good example is LISP, and Clojure in particular. TMP on the other hand is a special olympics started after the discovery that templates were accidentally turing complete.

In C++, metaprogramming is as straightforward as usual code. You can say the same thing about C too.

Speaking of special olympics...

This monthly posting is always good for a laugh.  (You've
got to laugh to keep from crying). The following entry
needs no further comment:

40. What's the best way to write a multi-statement cpp
macro?

A: The usual goal is to write a macro that can be invoked
as if it were a single function-call statement. This
means that the "caller" will be supplying the final
semicolon, so the macro body should not. The macro
body cannot be a simple brace-delineated compound
statement, because syntax errors would result if it
were invoked (apparently as a single statement, but
with a resultant extra semicolon) as the if branch of
an if/else statement with an explicit else clause.

The traditional solution is to use

#define Func() do { \
/* declarations */ \
stmt1; \
stmt2; \
/* ... */ \
} while(0) /* (no trailing ; ) */

When the "caller" appends a semicolon, this expansion
becomes a single statement regardless of context. (An
optimizing compiler will remove any "dead" tests or
branches on the constant condition 0, although lint
may complain.)

If all of the statements in the intended macro are
simple expressions, with no declarations or loops,
another technique is to write a single, parenthesized
expression using one or more comma operators. (This
technique also allows a value to be "returned.")


 No.856890

>>856869

>brainlet cries about too many parens

kys


 No.857152>>857188

>>856380

>Who are you quoting?

Some anon earlier who said that modern C++ is memory safe as long as you don't touch raw pointers. No idea if this is you. But I provided C++ snippets that don't use raw pointers yet still are memory unsafe.

Stop damage controlling and admit that C++ is memory unsafe.

>completely ignore what the post said

No

>Fucking leave, InaneBob.

No :^)


 No.857188>>857190

>>857152

If you're talking about this >>856278 "snippet" it's literally gobbledygook and not c++.


 No.857190>>857202

>>857188

Keep telling yourself that, C++ fag. C++ is still not memory safe.


 No.857192>>857195

File (hide): 27723c05f9667ae⋯.jpg (74.95 KB, 750x684, 125:114, 1493844262273.jpg) (h) (u)

guys i am a brainlet and can't into more than 1 thing. i want to go bare-metal. recommendations plz.


 No.857195


 No.857202>>857232

>>857190

Try and make a copy of it that compiles if you even can. See what happens then report back with what a retard you are.


 No.857204>>857232

>c++ is not memory safe

>provides examples to prove his point

>examples don't work and prove nothing

C++ is memory safe until the rustfag proves otherwise with a WORKING example


 No.857232>>857249

File (hide): 14ec8bb3eff7332⋯.png (53.84 KB, 500x534, 250:267, not an argument.png) (h) (u)

>>857202

>Try and make a copy of it that compiles if you even can.

Why don't you? Probably because you can't even program.

>See what happens

Undefined behavior happens

>>857204

>>c++ is not memory safe

Correct

>>provides examples to prove his point

That is when you C++ fags started crying

>>examples don't work and prove nothing

They prove that C++ is memory unsafe

>C++ is memory safe until the rustfag proves otherwise with a WORKING example

C++ is not memory safe. Anyways, I asked here >>856273 if modern C++ is memory safe. I got told that it is unless one uses raw pointers >>856276. The burden of proof is not on me. It is on you C++ fags claiming that modern C++ is memory safe to prove that. But you won't (can't) do that because you are just a bunch of butthurt LARPers. Why else would you bring Rust into this?

Kill yourselves


 No.857242>>857246

>be rustfag

>only argument is "no u"

>never shows any code he wrote in rust because "i dont want to be doxxed lol"


 No.857246

>>857242

>be c++fag

>only argument is "muh rustfag"

>never shows any proofs for his claims because he is only LARPing and can't actually program

I showed code in the Advent of Code threads though. Also I made this >>850894. Now it is your turn. Show me some code you have written.


 No.857249>>857250

>>857232

It's amazing that you can be so sure of what happens when you don't know enough C++ to make it compile.


 No.857250>>857252

>>857249

>The burden of proof is not on me

It's amazing that you can be so sure that modern C++ is memory safe when you are only LARPing.


 No.857252>>857253

>>857250

I never said it was memory safe. Just that your example isn't C++ and therefor not an argument about how memory safe it is.


 No.857253>>857254

>>857252

>being this desperate

I'm still waiting for proof that modern C++ is memory safe though.


 No.857254>>857255

>>857253

I'll provide it right after you give me an example of that code that works.


 No.857255>>857256 >>857315

>>857254

>I asked here >>856273 (You) if modern C++ is memory safe. I got told that it is unless one uses raw pointers >>856276. The burden of proof is not on me.

hmmmmm...


 No.857256>>857257

>>857255

Ok... so you admit that the code you provided doesn't work?


 No.857257

>>857256

Ok... so you admit that you are just a LARPer and can't prove that modern C++ is memory safe?


 No.857282>>857285 >>857286

File (hide): f770598f87914d0⋯.png (776.18 KB, 2048x833, 2048:833, t3_7rtgvk.png) (h) (u)


 No.857285>>857303

>>857282

>cannot write a compile-time raytracer yet

Wrong. Nobody has done it yet. http://www.treblig.org/daveG/rust-mand.html

>doesn't let you swap array elements

Wrong. https://doc.rust-lang.org/std/primitive.slice.html#method.swap


 No.857286


 No.857303>>857307

>>857285

>rustfag somehow gets triggered by an ironic virgin/chad comic made specifically to mock C++

Can't make this shit up.


 No.857307

>>857303

>gets triggered

Nah. Just correcting the record.


 No.857315>>857324 >>857325

>>857255

You mentally challenged homosexual, the burden of proof is on you because you are the one who made the first claim (C++ is memory unsafe). So unless you prove your claim with working and fucking sensible (not doing retarded things nobody does) code you have the burden of proof on you.


 No.857324

>>857315

>the burden of proof is on you because you are the one who made the first claim (C++ is memory unsafe).

>I asked here >>856273 (You) (You) if modern C++ is memory safe. I got told that it is unless one uses raw pointers >>856276. The burden of proof is not on me.

>>856273 >Do they make it memory safe though?

>>856276 >Just don't use raw pointers and you'll be fine.

Why are you so triggered? Is it because you know that modern C++ is memory unsafe and you can't prove otherwise? Sad.


 No.857325>>857370

>>857315

>not doing retarded things nobody does

Ahh. There it is. The standard excuse of the /tech/ LARPer. >only bad programmers write memory unsafe code.

https://www.cvedetails.com/vulnerability-list/


 No.857370>>857373 >>857374 >>860756 >>860757

>>856151

>I didn't ask for excuses.

I was adding information, you silly man. Maybe some poor misinformed guy thought that having access to standard was of any importance when the working drafts exist.

>>856152

>I have a thousand or two functions, variables and typedefs named 'template'

s/template/template_/

Problem solved.

>>856273

>mommy, i need muh memory safety! muh memory safety! muh memory safety! muh memory safety! muh memory safety!

lol, you're a joke

>>856278

The use of auto (without & or &&) implies that x is a copy of MyObject. So no, "x->whatever();" is not undefined behavior.

>>856310

Is this the kind of things that rust protects people from? Damn, rust really is a haven for retards.

>>857325

Prove that the people responsible for these vulnerabilities are good programmers.

>some bad programmer makes a really bad mistake

<daww you poor thing, it's not your fault. It's all the language's fault! Everyone is equally good and everyone gets a gold star!

This is your mind on rust.


 No.857373>>857383

>>857370

>reddit spacing


 No.857374>>857383

>>857370

>The use of auto (without & or &&) implies that x is a copy of MyObject. So no, "x->whatever();" is not undefined behavior.

Wrong. x->whatever() is UB. But of course a LARPer wouldn't understand this.

>Prove that the people responsible for these vulnerabilities are good programmers.

I never made the claim that those are good programmers. I was just showing that a lot of bugs exist in popular software because of C/C++ bullshit.


 No.857383>>857396

>>857373

>>reddit spacing

Do you think this:

>Prove that the people responsible for these vulnerabilities are good programmers.

>>some bad programmer makes a really bad mistake

><daww you poor thing, it's not your fault. It's all the language's fault! Everyone is equally good and everyone gets a gold star!

>This is your mind on rust.

is reddit spacing? Maybe you should go back to whatever shithole you crawled from.

>>857374

>Wrong. x->whatever() is UB

Why. You're calling whatever() on a copy of some object, so where's the undefined behavior?

>I never made the claim that those are good programmers.

Right, so we're free to believe that they're not good programmers at all. They may very well be bad programmers, and that could be the main reason for the bugs. The language doesn't force anyone to produce bugs.


 No.857396>>857401

>>857383

>Why. You're calling whatever() on a copy of some object, so where's the undefined behavior?

Because the object is a reference to an instance of a class that got deleted because the vector got cleared.

>Right, so we're free to believe that they're not good programmers at all.

My point is that it does not matter if the programmers are good or bad. What matters is that there are a lot of bugs because of C/C++ in popular software.


 No.857401>>857404

>>857396

>Because the object is a reference

Wrong. You're so fucking wrong. A reference would have to be written like this:

for (auto& x : v)
You clearly don't know what you're talking about.

>it does not matter if the programmers are good or bad.

>there are a lot of bugs because of [INSERT TOOL HERE]

This is the kind of thinking that desperately needs to disappear from the industry. It's like software engineering is the only engineering discipline where engineers are not expected to have any rigor or critical thinking. Imagine if a civil engineer fucked up badly and his bridge collapsed, killing dozens of people.

<nah it's okay bro, you did your best, you just need better design tools

Absolute insanity.


 No.857404>>857414

>>857401

>Wrong. You're so fucking wrong. A reference would have to be written like this:

no

>You clearly don't know what you're talking about.

stop LARPing

>It's like software engineering is the only engineering discipline where engineers are not expected to have any rigor or critical thinking.

Why are you continuously misrepresenting my point?

Again: My point is that a lot of bugs as a direct result of using shit languages (like C/C++) exist in popular software (like GNU/Linux).

Imagine if a civil engineer fucked up badly because he used shit tools and his bridge collapsed, killing dozens of people.

<what the fuck bro, why did you fuck up, stop blaming the tools

Absolute insanity.


 No.857414>>857423

>>857404

>no

yes

http://en.cppreference.com/w/cpp/language/reference_initialization

>direct result

How is it direct if the tools don't force the programmer to write defective code?

>a lot of bugs as a direct result of using shit languages

You have never given any evidence for that. The link you posted doesn't refute the idea that bad or careless programmers are responsible for most bugs.

>because he used shit tools

That would only be true if the tools actively fucked up his work, not just let him potentially shoot himself in the foot if he's careless, as is the case with C/C++.

><what the fuck bro, why did you fuck up, stop blaming the tools

Probably the right response.


 No.857418

This thread has convinced me that anyone talking about Rust should be autobanned.


 No.857423>>857429

>>857414

I'm in bed right now. You will get your (You) tomorrow.

Protip: I will disagree with you


 No.857429

>>857423

>Protip: I will disagree with you

Not surprising; you don't have much more than unsubstantiated disagreements (like that dumb "no" reply) to offer.


 No.857434

>rust is better because i say so but i will provide no actual arguments or show any code XD


 No.857556

>>856122

This is a very good example too: there are several very obvious and known safe patterns that are simply rejected by the rust borrow checker, and workarounds require a lot of creativity to figure out. What's worse, because of how alien the implementation of the concept is, it usually has to be rewritten from scratch when a new requirement comes in (for example maybe you suddenly need your tree to hold other trees, which may or may not be the same tree, and this is not possible due to a borrow dependency loop, without a complete rewrite).


 No.857624

>>856122

Stop lying. I posted a Rust solution on every day.


 No.857626

>C++

>not Holy C


 No.857798>>857826

File (hide): 5ca9bc10418822b⋯.jpg (68.37 KB, 672x504, 4:3, average anons.jpg) (h) (u)

C++ is a good language, fuck rust


 No.857826>>857827

>>857798

Both are complete and udder garbage.


 No.857827

>>857826

Lol udder instead of utter


 No.858190>>858192 >>858198

File (hide): 18a4386b3d22fff⋯.jpg (28.84 KB, 480x480, 1:1, 2qNqF2Y.jpg) (h) (u)

>>856310

>guise look at me I'm intentionally using a dangling pointer

unique_ptr makes sure to automatically release the object when it's destoryed, not prevent idiots like you from existing and manually intentionally doing stupid things.

You can be a retard in any language, you could decrease reference count to 0 in managed languages and try to use the object afterwards as well.


 No.858192

>>858190

>only bad programmers write memory unsafe code

and no. a managed language wouldn't allow you to do that.

get fucked, C++ fag


 No.858198

>>858190

>need to write helper classes to achieve something that should be backed into the language itself

Nice overhead. FAGGOT


 No.858203>>858223 >>859111

>>855881 (OP)

>Discuss why C++ is superior

It's a white mans language for white men.

It has literally zero downsides to any white man.

There is no mental overhead.

There are no worries.

There are no issues.

Things get written and they work.

Only nonwhites cannot deal with C++.

C++ is like a dog, if you're not white then you can at most tolerate it, but you will never channel the dogs potential into greatness like a white man.

You will never care as much for the dog like a white man.

That's why animal welfare, too, is implicitly white with very few shitskins.

It is also the same for environmental care.

The modern, white mans environment for the subhuman nonwhites, especially "present time" nonwhites is too confusing.

Their countries are filled with trash, often plastic, littered around their living spaces and rivers because nonwhites are used to only working with biodegradable, primitive resources they can just drop on the ground and have them rot away, while the nonwhite subhuman knuckle drags to the next point of its interest.

This is the ultimate truth.

The plastic bottles in your river are testament to that, angry shitskin which is inevitably typing up an angry reply to this.

But your bottles betray you, you dumb undercreature.

They betray you just as your tainted blood curse betrays you.

C++ Heil!


 No.858223>>858228 >>859201

>>858203

Travel more.


 No.858228>>859097

>>858223

>travel more

That's like asking me to eat a turd.

Not my kinda thing.


 No.858969

>>856136

>No, but the working drafts are about just as good

Actually the working draft by the Committee always include the current, complete, standard and point the direction the next version will go in. For example this includes all of C++17, and whatever new that has been promoted to the point that it is practically guaranteed to be in C++20:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4700.pdf


 No.859097

>>858228

>That's like asking me to eat a turd.

If you like C++ or C, you already do.


 No.859111>>860467

>>858203

Are you Terry's retarded brother?


 No.859157>>859200

>>855884

>I want more things that are defined at runtime and not at compile time

Why do you want slower programs? are you a fucking cuck?


 No.859200

>>859157

I'm only a single cuck unlike you the triple cuck.


 No.859201

>>858223

I have and he's mostly right.

non-white = no long term planning or stewardship of environment. Circles of theft until no one has anything and no one can invest and build without it getting stolen and wrecked. Eating the seeds instead of planting. Shitting in their water sources. Resigning themselves to life as prey instead of solving their problems.

You should travel more, perhaps?


 No.859204

5


 No.859205

Test


 No.860467

>>859111

>Are you Terry's retarded brother?

Are you using a garbage collecting language because you're a subhuman that cannot grasp the concept of things like "plastics" that your people throw into rivers, thinking the water will just dissolve it?


 No.860656>>860708 >>861053

C++ sucks because C is full of bullshit. AT&T shills induced Stockholm syndrome in the Ctards by exposing them to horrible syntax and semantics. C and C++ came from the same company.

I feel compelled to submit the following piece of C code:

switch (x)
default:
if (prime(x))
case 2: case 3: case 5: case 7:
process_prime(x);
else
case 4: case 6: case 8: case 9: case 10:
process_composite(x);

This can be found in Harbison and Steele's "C: A Reference
Manual" (page 216 in the second edition). They then remark:

This is, frankly, the most bizarre switch statement we
have ever seen that still has pretenses to being
purposeful.

In every other programming language the notion of a case
dispatch is supported through some rigidly authoritarian
construct whose syntax and semantics can be grasped by the
most primitive programming chimpanzee. But in C this highly
structured notion becomes a thing of sharp edges and lose
screws, sort of the programming language equivalent of a
closet full of tangled wire hangers.


 No.860708>>860769

>>860656

>In every other programming language the notion of a case

>dispatch is supported through some rigidly authoritarian

>construct whose syntax and semantics can be grasped by the

>most primitive programming chimpanzee.

Yeah, sorry Sambo, Pajeet and Co.

I just keep getting proven right here.

Again, plastics are not a weird type of wood. You must dispose of it correctly.

You must care for your environment before you pollute electronic environments too.

Too bad the chinese cannot read "care for".

Anyone who actually travelled through China will know that they just let everything rot even if they're using it.

C and C++ and co = intrinsically white, outside of the reach of the knuckledraggers.


 No.860756>>860828

>>857370

>>some bad programmer makes a really bad mistake

Find me at least one good programmer who never does these mistakes.


 No.860757>>860828

>>857370

>s/template/template_/

this will break shit because 'template' could be used not only in code, but also inside string literals, etc.

yours is a shit solution.

and C++ can't be called backwards compatible to C.


 No.860769>>861592

>>860708

Modern cars are easy to drive because the intelligence of its designers enabled them to make something that's complicated easy to use. C is like a "car" that's made of sticks that you have to "drive" by dragging your foot outside. Ctards get into "car accidents" like impaling themselves with pointy sticks, running over their own feet while trying to stop, and other "accidents" that are so stupid they would have never happened with a real car.

Engineering schools started teaching that those were normal 70s cars to avoid offending the "engineers" from "Sambo, Pajeet and Co.", the phone company that created "C" (for car) from "automotive research" to figure out the cheapest way to distribute phone books. They discovered sticks were a lot cheaper than cars, so they went with that.

C++ is an attempt to turn that into a real car.

    But it's much worse than than because you need to invoke
this procedure call before entering the block.
Preallocating the storage doesn't help you. I'll almost
guarantee you that the answer to the question "what's
supposed to happen when I do <the thing above>?" used to be
"gee, I don't know, whatever the PDP-11 compiler did." Now
of course, they're trying to rationalize the language after
the fact. I wonder if some poor bastard has tried to do a
denotational semantics for C. It would probably amount to a
translation of the PDP-11 C compiler into lambda calculus.


 No.860828>>861012

>>860756

>asking to prove a negative about "at least one good programmer"

Start by showing how often these mistakes occur in modern C++ codebases written by good programmers. There's no point in even talking about old C vulnerabilities introduced by careless programmers.

>>860757

>some language X adds a new keyword in a new version

<language X is not backward compatible because maybe someone somewhere used the keyword in a string :^))))))

It's not as easy as writing a regex, but it wouldn't be too hard for a non-Pajeet to write a program that performs this substitution while ignoring the contents of comments and strings.


 No.861012>>861721

>>860828

>Start by showing how often these mistakes occur in modern C++ codebases

Often enough to say that they are inevitable for nontrivial projects. Did you try searching the web?

>>860828

>It's not as easy as writing a regex, but it wouldn't be too hard for a non-Pajeet to write a program that performs this substitution while ignoring the contents of comments and strings.

It's still technically not backwards compatible and there are also other more subtle non-syntactical changes which you can search on the fucking web too.

If we define backwards compatible as "can be converted by means of non trivial source transformations" then languages like Pascal or even fucking Java are backwards compatible to C as well. Stop pretending to be dumb.


 No.861053>>861106

>>860656

How is this tangled? Cases are labels not statements, they do not create a new scope and fall through. Switch is a conditional goto.


 No.861106>>861128 >>861547 >>861579

>>861053

>How is this tangled?

Case dispatch is much simpler than C switch. It's easier to explain pattern matching than C switch and pattern matching is a lot more powerful. Switch is not the only problem with C/C++. C has the "clockwise/spiral rule" that wastes time on mental workarounds for C bullshit. The preprocessor manages to be defined in a way that both sucks and makes no sense (but that basically describes everything in C).

      OK.  How about:

switch (x)
default:
if (prime(x)) {
int i = horridly_complex_procedure_call(x);

case 2: case 3: case 5: case 7:
process_prime(x, i);
} else {
case 4: case 6: case 8: case 9: case 10:
process_composite(x);
}

Is this allowed? If so, what does the stack look
like before entry to process_prime() ?



I've been confusing my compiler class with this one for
a while now. I pull it out any time someone counters my
claim that C has no block structure. They're usually
under the delusion that {decl stmt} introduces a block
with its own local storage, probably because it looks
like it does, and because they are C programmers who use
lots of globals and wouldn't know what to do with block
structure even if they really had it.

But because you can jump into the middle of a block, the
compiler is forced to allocate all storage on entry to a
procedure, not entry to a block.

But it's much worse than than because you need to invoke
this procedure call before entering the block.
Preallocating the storage doesn't help you. I'll almost
guarantee you that the answer to the question "what's
supposed to happen when I do <the thing above>?" used to be
"gee, I don't know, whatever the PDP-11 compiler did." Now
of course, they're trying to rationalize the language after
the fact. I wonder if some poor bastard has tried to do a
denotational semantics for C. It would probably amount to a
translation of the PDP-11 C compiler into lambda calculus.


 No.861128>>861157

>>861106

>clockwise/spiral rule

I've never heard of this before and for good reason. Reading them left to right is easier and a better approach.

>C has no block structure

He used a bad argument against that. You can't claim something doesn't work by goto'ing into the middle of it. That's as stupid as saying:

<your function breaks if I goto halfway into it

OF COURSE IT DOES


 No.861157>>861196 >>861243 >>861260

>>861128

>I've never heard of this before and for good reason. Reading them left to right is easier and a better approach.

The syntax of C is horrible. This bullshit

void (*signal(int sig, void (*func)(int)))(int)
is just
int * (int -> unit) -> int -> unit
in OCaml syntax. It's a straightforward left to right reading.

>He used a bad argument against that. You can't claim something doesn't work by goto'ing into the middle of it.

C is so horrible that they can't even make goto work properly.

    Yes, and they've succeeded.  Hordes of grumpy C hackers
are complaining about C++ because it's too close to the
right thing. Sometimes the world can be a frightening
place.

I've been wondering about this. I fantasize sometimes
about building better programming environments. It seems
pretty clear that to be commercially viable at this point
you'd have to start with C or C++. A painful idea, but.
What really worries me is the impression that C hackers
might actively avoid anything that would raise their
productivity.

I don't quite understand this. My best guess is that
it's sort of another manifestation of the ``simple
implementation over all other considerations'' philosophy.
Namely, u-weenies have a fixed idea about how much they
should have to know in order to program: the amount they
know about C and unix. Any additional power would come at
the cost of having to learn something new. And they aren't
willing to make that investment in order to get greater
productivity later.

This certainly seems to be a lot of the resistance to
lisp machines. ``But it's got *all* *those* *manuals*!''
Yeah, but once you know that stuff you can program ten times
as fast. (Literally, I should think. I wish people would
do studies to quantify these things.) If you think of a
programming system as a long-term investment, it's worth
spending 30% of your time for a couple years learning new
stuff if it's going to give you an n-fold speed up later.


 No.861196>>861243

>>861157

Best way to handle C is typecast everything to void pointers at declaration time. Also write some wrappers for all syscalls and library functions, so everything expects void pointers. Then finally you don't have to stare at such ugly code anymore.


 No.861243

>>861157

>>861196

or just use a typedef

typedef void (*sighandler_t)(int);
sighandler_t signal(int signum, sighandler_t handler);

and now you are back to something readable.

>>861157

>C is so horrible that they can't even make goto work properly.

It does work properly. It just branches to the label you specify. It doesn't advertise any additional behavior.


 No.861260>>861556

>>861157

>I am the academic and a scholar and want to spend all my life studying over-engineered complex features and jerk off over my math theory because I loooove CS. I am the real nerd guys, not like those code monkey Pajeets and too retarded to understand anything other than C "programmers". I laugh at all those peasant C retards. I am soooo much better than them, amarite guys?? I love spending all my time writing Emacs plugins and I 140% more productive with my 274 shortcuts.

Functional programming people are the worst. I am happy that the REAL functional programming languages lost all chances into going mainstream. All those fake functional AIDS ridden dogshit like Scala and all those new hipster languages that incorporate some functional features are just the new fad for people to jerk themselves at conferences.


 No.861547

>>861106

One block = one set of variable declarations. Used to be that they all had to be on top. You need this consistency for the rest of the block to make sense. However definitions are not required for that thus they follow a regular statement flow, so for every defaulted value horridly_complex... is evaluated and for every cased (?) value it is not and i is garbage. Entry into a procedure in a block implies entry into that block.

It makes sense, you don't want something to run if it was goto'd over, but there is no way in the language to see if a variable was succesfuly declared, thus they shall always be presumed to be. Sure, all vars on top makes even more sense but readibility and convinience trump over edge cases that can still be explained away.


 No.861556

>>861260

monkeys aren't allowed to post here


 No.861579

>>861106

Who's quotes are these? Just because something is in quote form, doesn't mean it's smart.


 No.861592>>861784

>>860769

> Ctards get into "car accidents" like impaling themselves with pointy sticks, running over their own feet while trying to stop, and other "accidents" that are so stupid they would have never happened with a real car.

What next? Are you going to make a case for mittens being superior to gloves because gloves are too complex and might cause "some people" to snag their fingers in something?

Yeah, I'm sorry, Sambo.

The thing you dealed cheap crack for to afford it to appear hood rich and you can only drive for two miles before it needs to be taken to a (((certified workshop))) because ((( real cars ))) don't allow you to tinker with things will end up getting you killled because no manufacturer of a "real car" would want niggers around their property and settling in court is less of a hassle than dealing with you.

I'm still baffled that anything could be confused by a switch statement, though.

I bet the average border collie would understand it with some training.


 No.861676>>861716

Can someone point me to a grep tool written in C++ that is faster, safer and more modern than ripgrep, which is written in the safe systems language RUST?


 No.861715>>861731

Closest thing tbh:

http://perlpowertools.com/


 No.861716>>861757

>>861676

>Modern

AKA missing 90% of the features


 No.861721

>>861012

>Did you try searching the web?

<nah bro, i'm not going to support my claims in the only relevant context, you should do all the work for me

Just admit that your claim only really applies to carelessly written old C code.

>non trivial

Is replacing keywords outside of strings and comments considered a nontrivial task nowadays? As hard as converting C to Pascal?? That's kind of sad.


 No.861731>>861746 >>861749

>>861715

Watch out because a *BSD retard will come and say "it doesn't have the same features".

Well, yes, a Ferrari does not have the same features as Ford.


 No.861746

>>861731

>A car and a box truck both get you from place A to B so they are the same despite the very different functionality


 No.861749

>>861731

>>WTF I cant fit my couch is the back of this car

>they are both forms of transportation so I thought it would be a good idea to replace your truck


 No.861757>>861759

>>861716

Actually in some ways it has more features and more modern ones.


 No.861759>>861777

>>861757

Those modern features are gonna be great when they break everything that uses grep and causes thousands of man hours of damage.


 No.861777>>861781

>>861759

> thousands of neckbeard hours trying to arrange pedophile images by their original japanese names

no thx


 No.861781

>>861777

>neckbeards are the only people that use grep

okay bud


 No.861784>>861791 >>862163

>>861592

>What next? Are you going to make a case for mittens being superior to gloves because gloves are too complex and might cause "some people" to snag their fingers in something?

If the gloves were made of pointy sticks and had to be put on your ears while hopping on one foot before you can wear them, I would prefer mittens, but I'd rather have gloves that do the right thing and make sense.

>The thing you dealed cheap crack for to afford it to appear hood rich and you can only drive for two miles before it needs to be taken to a (((certified workshop))) because ((( real cars ))) don't allow you to tinker with things will end up getting you killled because no manufacturer of a "real car" would want niggers around their property and settling in court is less of a hassle than dealing with you.

I'd have to be on crack or C++ to understand this sentence. From what I can make out, it's a good description of what it feels like to use C++.

Here's another great one:


38. How can I write a generic macro to swap two values?

A: There is no good answer to this question. If the values
are integers, a well-known trick using exclusive-OR
could perhaps be used, but it will not work for
floating-point values or pointers, (and it will not
work if the two values are the same variable, and the
"obvious" supercompressed implementation for integral
types a^=b^=a^=b is, strictly speaking, illegal due to
multiple side- effects, and...). If the macro is
intended to be used on values of arbitrary type (the
usual goal), it cannot use a temporary, since it does
not know what type of temporary it needs, and standard
C does not provide a typeof operator.

The best all-around solution is probably to forget
about using a macro, unless you don't mind passing in
the type as a third argument.


 No.861791>>862101

>>861784

Oh no, no swap macro, I guess the language is trash


 No.862101

File (hide): 37bc4b1ed65fe3d⋯.jpg (74.12 KB, 480x480, 1:1, i-dont-get-it.jpg) (h) (u)

>>861791

How would one even use a swap macro? I don't get it.

How about this one that works for all types?

#include <stdio.h>

#define SWAP(a,b) b,a

void main(void)
{
int a = 1, b = 2;
printf("%d and %d\n", a, b);
printf("%d and %d\n", SWAP(a,b));
}


 No.862163

File (hide): bc009d1a599ff91⋯.jpg (53.82 KB, 480x319, 480:319, 832-369126.jpg) (h) (u)

>>861784

>If the gloves were made of pointy sticks

Then you'd feel right at home.


 No.864175

hello yes i am a troll pajeet your language is shit goodnight


 No.872754

Who needs objects just use structs


 No.873184>>873192

``` c

#include <iostream>

#include <string.h>

static const char* meme = "* * * * *";

int main()

{

const unsigned len = strlen(meme);

for (unsigned i = 0; i < len; i++) {

puts(meme + (len - (i + !(i & 1))));

}

}

```

this code gave me cancer :D


 No.873186

Oh I forgot, this is not discord


 No.873192

File (hide): acd6abf9117540c⋯.jpg (148.02 KB, 1000x750, 4:3, pleb.jpg) (h) (u)

>>873184

>discord markup

Get the fuck out




[Return][Go to top][Catalog][Screencap][Nerve Center][Cancer][Update] ( Scroll to new posts) ( Auto) 5
172 replies | 26 images | Page ?
[Post a Reply]
[ / / / / / / / / / / / / / ] [ dir / 2hu / animu / asmr / cafechan / rule34 / tk / u / zoo ][ watchlist ]