d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Need A C Programmer's Help > Don't Know Where To Start
Prev123Next
Add Reply New Topic New Poll
Member
Posts: 6,481
Joined: Jul 5 2009
Gold: 0.70
Jul 14 2016 06:01am
Quote (KrzaQ2 @ Jul 14 2016 06:07am)
How is C objectively superior?


Straight from Linus:

http://thread.gmane.org/gmane.comp.version-control.git/57643/focus=57918
Member
Posts: 9,803
Joined: Jun 28 2005
Gold: 6.67
Jul 15 2016 12:29am
As intelligent as he is, he is capable of being wrong - as this rant clearly shows. Besides, it's a decade old *opinion* based on knowledge older by another decade. That's hardly an answer to "how is C objectively superior?".
Member
Posts: 3,939
Joined: Feb 1 2013
Gold: 2,749.09
Warn: 20%
Jul 15 2016 01:44am
Quote (KrzaQ2 @ Jul 14 2016 11:29pm)
As intelligent as he is, he is capable of being wrong - as this rant clearly shows. Besides, it's a decade old *opinion* based on knowledge older by another decade. That's hardly an answer to "how is C objectively superior?".


Before I bother to answer you myself, prove you aren't an idiot by thoroughly qualifying the bolded sub-statement. With quotations and code samples please.
Member
Posts: 9,803
Joined: Jun 28 2005
Gold: 6.67
Jul 15 2016 02:44am
Before I provide quotations and code samples, prove you're not an idiot by providing dictionary definition of word "objective" and how it refers to opinions - like the one you linked.

Honestly, I cbf to elaborate, you certainly don't strike me as a person who has skill to match their ego. That being said, consider the following:
- until very recently the Linux kernel had 4 or 5 implementations of linked list. Possibly incompatible. How's that for superior?
- goto fail. Need I say more?
- C is primitive. Sure, understanding what happens in each statement is easy, but you could tell the same about assembly, yet hardly anybody claims that assembly of anything larger than nop is readable. You could say that C is a sweet spot between readability and lack of magic, but that'd be an opinion (so it wouldn't be something *objectvely* better). And I'd disagree.
- type safety. C++ isn't perfect, because of C compatibility, but it's a lot better. Unless you consider that a disadvantage?
- templates (ok, C11 has generics, but it's like templates' retarded cousin). You could say that using void* instead is better and safer but that'd be a lie. Or a dumb opinion? Meh
- RAII. RAII alone should be enough to drop C in favour of C++.
- exceptions are meh, but they do beat C's approach to error handling (errno, anyone?) by a mile. That being said, Haskell/Rust and even Go are so much better here.
- qsort vs std::sort (google it)
- writing idiomatic C++ pretty much eliminates all the memory (or resources, more like) errors. Before you say that shitty C++ code is shitty - well, so is shitty C code.
- "zero-cost abstractions" are, in fact, zero cost. You should try them.

Btw, I am pretty disappointed by Linus' rant. C++ has a fair share of problems, but he has chosen to focus on those that had been long since solved or aren't problems at all. There's no problem with portability in C++ (want an example - look at Qt - except for system-specific code and some workarounds for ancient compilers, the same codebase is provided for Windows/Linux/Mac and other systems). Of course he was talking about state of the art in 1995. But that's a weak argument. The abstractions argument is even worse. If the change is so big that it warrants a complete rewrite I fail to see how it could be avoided with C. And this isn't 2003 anymore, compilers are good-ish at pointing the errors now.

From someone with his skill, I would expect more technical reasons. Like:
- C++03 requires working against the language to get the best performance sometimes (i.e. move semantics)
- no defined ABI standard, no de-facto standard (C rules here)
- no modules
- lots of code forced to exist in the headers
- compilation times (can be offset by careful splitting the code into pseudo-modules and PIMPL)
- Undefined Behaviour. Sure, C has lots of it too, but C++ just makes it explode more.
- there's definitely more, that's from the top of my head

I elaborated, didn't I? :/

This post was edited by KrzaQ2 on Jul 15 2016 02:59am
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Jul 15 2016 07:04am
Quote (KrzaQ2 @ Jul 15 2016 04:44am)

I elaborated, didn't I? :/


You forgot code samples, your argument is null and void <3
Member
Posts: 6,481
Joined: Jul 5 2009
Gold: 0.70
Jul 15 2016 09:12am
Well at least you know what you're talking about

I was just kidding with my post, it's just a favorite thread of mine :P

IMO there are better tools for certain jobs, not objectively better languages
Member
Posts: 3,939
Joined: Feb 1 2013
Gold: 2,749.09
Warn: 20%
Jul 15 2016 07:44pm
Quote (mebeatyou @ Jul 15 2016 08:12am)
Well at least you know what you're talking about

I was just kidding with my post, it's just a favorite thread of mine :P

IMO there are better tools for certain jobs, not objectively better languages


Yea I agree, for example C is a better tool for the job of programming computers ;)
Member
Posts: 1,563
Joined: Feb 10 2007
Gold: 0.44
Jul 31 2016 03:08am
:banana:
Member
Posts: 2,683
Joined: Jun 27 2009
Gold: 9.00
Sep 5 2016 04:48pm
Quote (boxboxbox @ Jul 15 2016 06:44pm)
Yea I agree, for example C is a better tool for the job of programming computers ;)


Truth. If you know how to handle C, you can do anything that C++ can do without the limitations of C++. While this is vague, it just means that while C++ provides you a lot of framework, it actually limits your initial ability to create.
Member
Posts: 15,081
Joined: Jun 13 2016
Gold: 10.69
Oct 21 2016 07:59pm
Quote (aCaseofNoob @ Sep 5 2016 11:48am)
Truth. If you know how to handle C, you can do anything that C++ can do without the limitations of C++. While this is vague, it just means that while C++ provides you a lot of framework, it actually limits your initial ability to create.


agreed find both useful tho
Go Back To Programming & Development Topic List
Prev123Next
Add Reply New Topic New Poll