[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

C vs C++

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 69
Thread images: 3

File: 1501631445870.jpg (150KB, 640x852px) Image search: [Google]
1501631445870.jpg
150KB, 640x852px
Why should I use C++ over C for hobbyist programming?
>>
For hobbyist, stick with Java or C#.
Or with C, if you want 'muh memory management'.
C++ provides much, much more possibilities, but they sometimes are really complicated and need really good practice.
>>
just use python, brainlet.
>>
>>62227990
if you're hobbyist, use this. package management is really nice and you can use stuff you write on linux, windows or mac.
>>
>>62227901
You shouldn't. The main problem with C++ is other C++ programmers. If you're working alone, C++ is far superior.
>>
>>62227901
Because it stops you from wanting to die every single time you need to accept input from the user, do literally anything with strings, manage collections of data, etc.
>>
>>62227901
So you can write template magic incomprehensible to everyone else.
>>
>>62229143
This.
>>62229121
So he should, but not once he's a professional?
>>
>>62229420
Everyone writes C++ differently. Professional C++ is a nightmare.
>>
>>62227901
hobbyist programming in C++ is super fucking fun. Having such a low level language with the ability to make high level abstractions is the perfect combination.
>>
>>62229435
Then again, most people write C wrong, so professional C must be a nightmare as well.
>>
>>62227901
Any more of her images?

I got one other of her and I find it super hot

Does anyone have tips on design patterns in C++? I'm just a beginner but I have no clue how to structure my programs well (mostly for computer graphics related applications).
>>
>>62229565
Computer graphics is a bit different than regular C++ because you're always going to be having to wrap a horrid state machine in objects (well, for OpenGL anyway, haven't tried Vulkan enough to know the proper approach). For this I usually just use a lot of heap allocated objects with constructors/destructors that interface with said state machine and be really fucking careful I don't leak any of them. (Rather than trying to build rule-of-three/rule-of-five move/copyable objects).
>>
>>62227901
Because of STL and Objects. Makes life a lot easier.
>>
>>62229532
How does one write C++ correctly?
>>
>>62227901
Use C++ for RAII, STL, polymorphism, smart pointers. It's not like you wouldn't reinvent the exact same thing in C, only shitty.
>>
>>62229565
Don't fall for her nerdy faux. She's on facebook
>>
>>62230461
Yeah she's not https://github.com/onodera-punpun for sure
>>
>>62229565
Don't fall for the meme. It's the only set where she looks somewhat good and that's several years old now. She's in her thirties now and balding, aged like milk.
>>
>>62230952
Was she a moderator on lainchan? Do you know her?
>>
>>62230429
doxygen comments in header files
implementation in source files
Avoid writing C
>>
>>62230456
That's basically how I've always felt about C. No matter what you're trying to do, C++ will always have an optimized solution already created in either the standard library or one of the Boost libraries.
>>
>>62231111
Where's the optimized hashmap?
>>
>>62229565
>hot
Like >>62230952 said, she's indeed balding (https://warosu.org/g/thread/57194939#p57201247 ) She isn't on her 30s but one can be forgiven for thinking so.

>>62230855
"onodera" is a skinny light haired duch boy tho.
>>
>>62227901
C++ for show
C for a pro
>>
>>62231645
Hm ok. He lives about 50km away from me. I don't think she lives in the Netherlands though.
>>
>>62232469
She's from western australia
>>
File: tears.png (415KB, 1286x724px) Image search: [Google]
tears.png
415KB, 1286x724px
>>62232574
Thanks bud, would have been cool.
>>
>>62227901
Because it has stl, g++ has better error description, with a bit of OOP you can make your project cleaner, you can arrange your memory de-allocation in destructors, you can use function overloading which will make your project look even cleaner.... And there are 6 gorillion other reasons to use c++.
Also, there are other 6 gorillion reasons to avoid c++1X
>>
>>62232607
She's a total bitch tho. She used to be a lainchan admin, with kalyx and his shenanigans (just look how he scammed appleman after selling him the website, then tried to "steal" the users by making the .jp domain). Then she kept attention whoring on the vola gentoomen room.
Now I think she shitposts on irc on #dprk #plez and sometime on #rice, I don't hang out with these cool kids anymore.
>>
>>62227901
Rust
>>
>>62232607
>>62232727
and she also tripfagged on /fa/ when she was underage
>>
>>62229420
>So he should, but not once he's a professional?
There is no such thing as pro-c++ programmer.
C++ has no coding style and rules that apply on projects.
C, otoh, does and that's why it is much cleaner and prefered by, e.g. linux.
Every c++ project follows a completely different style on what or what is not allowed in the way you program.
In here, i've the feeling that c++ pros are the monkeys that adapt sooner the new features.
In reality a pro, is someone who can make a 40k loc project and still be able, for anyone, to use it and expand it.
>>
>>62227901
If you are making windows forms, I believe C++ is better. Otherwise, use C.
>>
>>62232607
Go hang yourself, pedo.
>>
>>62231645
disgusting hairline indeed
>>
I have a nude of her
>>
>>62233321
Seen her irl. She's weird asf on IRC. Come to think of it, everyone from lainchan was kind of fucking weird on IRC.
>>
>>62233425
also emacs is gross :^))
>>
Use Rust. It replaced all of the languages mentioned in this thread.
>>
>>62227901
>>62227990
This. Python is the way to go if you want to write up something quickly.

pip install <my current project>

>>62231645
>>62232469
>>62232574
>>62232727
>>62233321
>>62233425
More info on computer girl?
[spoiler]years of university surrounded by sweaty males has taken its toll on me, seeing any girl with a think pad is magical to me[/spoiler]
>>
>>62233502
Any reasons why OP should use Rust?
>>
>>62233547
It's the future. It's objectively better than both C and C++, having the same low level power while providing high level features, safety, simplicity, and elegance. It replaces C#, Java, and Python for the same reasons. It's the best there is.
>>
>>62233608
lol
>>
>>62233608
Can straight white males use it?
>>
>>62233608
>some marginal advantages and cosmetic features vs 20 years old codebase of probably everything
>>
File: 1440759970807.jpg (67KB, 640x852px) Image search: [Google]
1440759970807.jpg
67KB, 640x852px
What did she mean by this?
>>
>>62233608
Yeah all video games are coded it rust. Made c++, Java, and programming shaders in c obsolete. My DAW was even programmed in rust...
>>
>>62234051
That 20 years worth of old crap is the problem.
>>
>>62234469
I said it's the future, not the past.
>>
>>62233608
It has zero elegance.
There is nothing elegant about their moronic lifetime system and .unwrap(), .Ok(), .expect() everywhere because some retard decided that literally every fucking thing should be wrapped in obligatory error handling for no reason.

Stop this bullshit about it being elegant.
>>
>>62234981
Error handling with Result<T, E> is a million times better than C++'s try-catch nonsense.
>hiding execution paths and return values is a good idea
Complete nonsense.
>>
>>62235014
at least with try-catch YOU decide where things should throw errors and where they should be checked.

almost everything in rust's standard library requires you to check for errors for things that will NEVER happen. I wrote a toy program in rust and unwrap(), Ok() and expect() were at the end of almost every fucking function call.

function f takes x and returns y with field z
how is it reasonable that I should have to do
f(x).unwrap().get_z().unwrap() just because there is some one in one trillion chance that something might go wrong TWICE in that line?
>>
>>62235072
I can tell that you write shitty code. You're the sort of person who puts one try-catch block in main and thinks he's done thinking about errors.

Errors are values. Deal with them. Exceptions hide errors and make it harder to reason about whether or not code will work or if it will invisibly fail.
>>
>>62235072
it's almost like Rust is concerned with safety or something
>>
>>62235301
>>62235282
You would be wrong to think that.

I agree that errors and exceptions are important, but if I am writing code to write to a file, why do I have to write exception catching code 4 or 5 times, once per function call, rather than put a try-catch around the block where I write to the file that will warn the user with something useful like "Failed to write to the file" rather than have to write 5 different error messages and pattern match over every result?
>>
>>62235390
You sound like you haven't used Rust.
>>
>>62235390
>why do I have to write exception catching code 4 or 5 times
You don't. You write one handler function and call it on or_else. Or you just return the error early if you don't care about handling it here.
Same shit as with exceptions (catch it, or let it propagate down the stack) except now you can actually see what the fuck's happening and it isn't implicit and hidden.
>>
>emacs
bitch is dead to me
>>
>>62230429
The way I autisticly write it. everyone else is wrong.
>>
>>62235014
what is wrong with the try catch paradigm?
It is much safer than goto FAIL, just as easy to implement and you can easily setup a very flexible system or track down errors that isn't handled.
>>
>>62235616
Most languages don't use checked exceptions, is the problem.
>>
>>62232656
Why avoid c++1x?
Also I read many times that deallocation of memory in destructors leads to memory leaks.
>>
>>62235664
So you think that because you can have an empty catch statement, every catch statement is empty?
If you assume the programmer is lazy, why not assume they don't catch it at all and just use it as a nicer way to print what was wrong and why the program failed?
>>
>>62235390
There's syntactic sugar for error propagation in Rust. Literally add a couple of question marks and only handle errors at the appropriate level.
>>
>>62235822
This is nothing to do with empty catch statements though. You can ignore an error Result in Rust too.

All I want is to be able to know what effect a function will have on my program by looking at its signature. Result types let me do that. Checked exceptions also do it to a lesser extent.
>>
>>62233523
Girls in a man dominated field often turn to be huge sluts. This is especially true in engineering and computer science as they are surrounded by a lot of sweaty beta orbiters, constantly being given attention, special treatment and basically praised for using a text editor.
>>
Personal projects = LISP + Emacs
>>
>>62234382

That's a man baby.
Thread posts: 69
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.