[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
▼ Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: rust_vs_c_4a4124b5b8.jpg (11 KB, 472x250)
11 KB JPG
For me, the problem with C++ isn't even its inherent lack of security, it's the fact it's loaded with thousands of features (way more than Rust) which increase mental burden of the programmer while providing miniscule value in return - you're paying with your time and mental capacity for (almost) nothing.
>>
File: posteditagain.png (30 KB, 600x600)
30 KB PNG
>>109912686
>>
>>109912686
You could just simply get good and dilate
>>
File: Cpp.png (92 KB, 1593x357)
92 KB PNG
>>109912686
Cpp is king and you know it.
>>
>>109912694
>thousands of vulnerabilities in software used by billions
Where are those good C++ devs who don't make mistakes, then?
>>
>>109912706
C++ can be more performant.
Can you - a /g/ nocoder - write more performant C++ code?
The answer is a resounding "no".
>>
>>109912709
>no sanitizers
>no checks
>no formal proofs
>not even a single assert statement
>didn't read the spec one single time in his life
>doesn't know what undefined behavior actually is
>didn't ever build a single project on -O3 or saw the output assembly
"C aNd C++ iS uNsAfE aNd ObSoLeTe"
>>
>>109912686
You don't have to use the majority of features. In fact, in my industry (defence) we are not allowed to.
Rust is a meme
>>
>>109912720
Well, practical evidence (tons of CVEs in C/C++ software) show they are.
>no sanitizers
>no checks
>no formal proofs
>not even a single assert statement
>didn't read the spec one single time in his life
>doesn't know what undefined behavior actually is
>didn't ever build a single project on -O3 or saw the output assembly
Why aren't actual employed C++ devs using it, then?
>>
>>109912732
Did you ever see an actually employed C++ dev?
No anon, your voluntary working open-source project devs don't count.
>>
>>109912731
I have no control over other people's code.
You have to use other people's code if you aren't a nocode fizzbuzzer.
>>
Why don't they make a c++ fork that removes the useless features and call it c--
>>
>>109912742
So, they're using it all and yet - somehow - despite your claims that it solves security - hundreds of CVEs are found every day in mainstream software developed in C/C++.
>>
>>109912745
Backwards compatibility.
>>
>>109912686
For me, it's Bend
https://bend-lang.com/
>>
C++ supports multiple paradigms, so it's not necessary to utilize all of its features. Perform as required.
>>
>>109912716
Actually, as the post exposes clearly, the answer is a resounding 'yes'. The point is that the constructs are readily available for use. Every retard can learn about basic templates, which allow building code that doesn't rely on void* and its forced pessimization. That alone already defeats C. In theory, C can work around that by abusing macro magic. In practice, appropriate macros for most of these usecases are paragraphs-to-pages long or extremely brittle (or both). Thus, to achieve the same performance in C++ than in C requires a far higher skill level. That said, getting better performance in most platform asm's compared to C or C++ actually requires less skills, if you ignore the requirement to know about data structures more deeply, for example by assuming that you'll just link to a C data structure library for these.
>>
>>109912745
c-- already exists, it's a kind of universal assembly language for haskell that was built for the glasgow haskell compiler. It's no longer in use though.
>>
>>109912838
Again: I have no control over other programmers and what they do.
>>
>>109912894
Simply preserve their programming style. What makes you attempt to control them?
>>
>>109912709
here, ama
>>
>>109912959
>Simply preserve their programming style
Which means I have to learn tens of vastly different programming styles since everyone does C++ differently.
Other languages (both natural and programming) don't have this problem.
>>
>>109912869
Advantage over C, but not Rust since it has generics and static dispatch.
Also C++ templates are basically untyped/weakly-typed generics - yes, they are more powerful, but you're paying with weaker compiler guarantees and terrible compiler error messages for generalness you very rarely need.
>>
>>109912975
How was your recent fizz buzz?
>>
File: 1790419840.png (59 KB, 200x409)
59 KB PNG
>>109913033
>terrible compiler error messages
>caring
>in the age of llm's
>>
>>109913033
>Advantage over C, but not Rust since it has generics and static dispatch.
Yes.
Rust makes it easier than even C++ to write decent code by default. However, the borrow checker is too onerous and in practice, any non-trivial codebase ends up either using unsafe or (most likely) putting RC everywhere, which has a pretty steep cost (namely the same as smart pointers in C++).
>>
>>109912985
Every project has its guidelines. The same goes for other languages as well as C++.
>>
>>109912869
>void* and its forced pessimization
the fuck are you talking about

>In practice, appropriate macros for most of these usecases are paragraphs-to-pages long or extremely brittle (or both)
try 1 line per function, faggot
>>
>>109913042
never made one
>>
>>109913152
Yet another cnile cmen who doesn't know shit about his own shitlang. Lmao.
>>
>>109913167
you can get generic container behavior in C with minimal effort. you simply don't know about the 3 sea shells
>>
>>109913179
You will never be more than a fizzbuzz jokey.
>>
>tfw your C++ classes have no friends
>>
>>109913187
it's funny because you still don't know
>>
>>109912869
>>109913167
oh no, literal paragraphs of horrible, brittle macro hacks! generic containers in C are so impossible!!

generic containers in C in reality:
#define Type_Check(ResultPtr, ComparisonPtr) ((1) ? (ResultPtr) : (ComparisonPtr))

#define dynamic_array(T) \
struct { \
T* Base; \
size_t Count; \
size_t Capacity; \
}

typedef dynamic_array(byte) generic_dynamic_array;


void* Dynamic_Array_Append(generic_dynamic_array* Array, void* Element, size_t ElementSize) {
// ...
}
#define Dynamic_Array_Append(Array, Element) Dynamic_Array_Append((generic_dynamic_array*) (Array), Type_Check((Element), (Array)->Base), sizeof (*Element))

typedef struct {
int Bar;
} foo;

int main(void) {
dynamic_array(foo) FooArray = {0};
Dynamic_Array_Append(&FooArray, &(foo){.Bar = 123});
return (0);
}


wow sooo hard
>>
>>109913245
Nice self-own, cnile cfag.
>>
>>109913257
I accept your concession. Kneel.
>>
>>109913245
>Having to use another language to glue the stuffs that the base language lacks
Wow you sure proving a point here in favor of rust and cpp.
>>
>>109913245
holy shit, it's terrible
>>
>>109913267
I'll take fries with that. Extra dip.
>>
>>109912686
Are you considering the c++ standard library as part of the language. Because if you do then yes c++ does have thousands of features. But in my code the entire std:: namespace in banned. I use actual C++ the language, not the standard library slop.
>>
>>109913245
>void*
surrender: accepted
>>
>>109913269
macros are obviously not great, but this interface does exactly what it needs to with minimal effort.

>>109913273
>>109913275
cope and seethe

>>109913281
it doesn't matter, it is type checked before it becomes a void*
>>
>>109913290
... you don't even know what the code does huh, impressive
>>
>>109913290
>cope
I am trying anon, but it's just so bad. can't believe people live like this.
>>
>>109913297
it provides a generic type-safe interface for any arbitrary type
>>
>>109913303
And you double down, showing you have 0 clue what you're doing. Did a clanker do this for you? Not even to mention that all this garbage you made still pessimizes exactly like was pointed out to you before.
You really are just walking straight into it aren't you.
>>
>>109913310
>showing you have 0 clue what you're doing
I very clearly know what I'm doing. Element must be of the same pointer type as Array.Base or the compiler will complain, so you have type safety right there.

>still pessimizes
you're going to have to elaborate, unless you're referring to having to rely on some form of a memcpy
>>
>>109912686
rust needs some equivalent of a move constructor, the fact that I can't have self referential data in a performance oriented language is insane
I'm forced to replace a simple pointer dereference with branching
>>
>>109913325
>babby doesn't know programming 101 concepts
>has never used C before
>triple downs on the most retarded self-pwn yet
Amazing
Cterminal cnility.
>>
>>109913245
what's wrong with writing assembly again?
>>
>>109913470
b-b-but it's not p-portable...
>>
>>109912706
are you the tard in picrel quoting your tard self?
a yes answer would be less tarded than you being a vicarious tard /g/eet quoting an orange site tard.
>>
>>109912686
That's a valid concern although Rust has some very odd decisions and it's verbose. It's still much better than C++ in that regard. Rust doesn't really have any particular super power, it just picked the good ideas from Haskell and C++ and put them in syntax.
>>
>>109913572
It's really sad that /g/eet is a real banger because you are always so moronic everytime you post.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.