[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
C++ is a horrible language. It's made more horrible by the
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 69
Thread images: 5
File: Bjarne.jpg (159 KB, 600x437) Image search: [Google]
Bjarne.jpg
159 KB, 600x437
C++ is a horrible language. It's made more horrible by the fact that a lot
of substandard programmers use it, to the point where it's much much
easier to generate total and utter crap with it. Quite frankly, even if
the choice of C were to do *nothing* but keep the C++ programmers out,
that in itself would be a huge reason to use C.

In other words: the choice of C is the only sane choice. I know Miles
Bader jokingly said "to piss you off", but it's actually true. I've come
to the conclusion that any programmer that would prefer the project to be
in C++ over C is likely a programmer that I really *would* prefer to piss
off, so that he doesn't come and screw up any project I'm involved with.

In other words, the only way to do good, efficient, and system-level and
portable C++ ends up to limit yourself to all the things that are
basically available in C. And limiting your project to C means that people
don't screw that up, and also means that you get a lot of programmers that
do actually understand low-level issues and don't screw things up with any
idiotic "object model" crap.

So I'm sorry, but for something like git, where efficiency was a primary
objective, the "advantages" of C++ is just a huge mistake. The fact that
we also piss off people who cannot see that is just a big additional
advantage.

If you want a VCS that is written in C++, go play with Monotone. Really.
They use a "real database". They use "nice object-oriented libraries".
They use "nice C++ abstractions". And quite frankly, as a result of all
these design decisions that sound so appealing to some CS people, the end
result is a horrible and unmaintainable mess.
>>
are there any books on modern c++ for people who are already familiar with programming? Also are there any books that describe the theory of oopm?
>>
>>54428730
Object oriented programming is dead

Lisp and Haskell killed it
>>
>>54428712
Them consulting opportunities tho...
>>
>>54428749
>lisp
Has it even been used for anything major in the past 5 years?
>>
Meme
>>
>>54428772
Reddit
>>
>>54428772
This is a joke, right?
>>
>>54428772
>Has it even been used for anything major in the past 50 years?
FTFY
>>
>>54428772
The problem is that people who understand it are expensive. Management hates that shit.
>>
>>54428772
no, people use closure in the industry though
>>
>>54428812
Haha yea that's the reason why no one uses it ;)
>>
Why can't you just use JavaScript for everything. I learned it at my cc it seems pretty good
>>
>>54428837
For solving complex problems, it remains a very compelling choice.

Of course, most development does not involve complex /technical/ problems.
>>
>>54428830
Clojure?
>>
>>54428892
Which complex problems
>>
>>54428923
Famously worked pretty well for airline search and booking at ITA. Backend has to interface with huge variety of archaic systems, standardize the data retrieved.

Also when the machine learning frenzy burns itself out, these folks will rediscover expert systems.
>>
>>54428795
http://www.aaronsw.com/weblog/rewritingreddit
>The Python version had less code that ran faster and was far easier to read and maintain.

Python with no macros is shorter than Lisp with macros. Imagine rewriting something in Python, of all languages, and having your code run faster!

>>54428812
Managers want something that can be easily read and can work well with IDEs and other tools. Static typing and not having macros make things easier. It's not about you being more intelligent than everyone else in the company, it's about programs that can be maintained without you. Besides, if they wanted to pay more for programs that nobody else in the company can understand, they would hire assembly programmers and other people with real talent, not narcissists who are worse than the average Python programmer.

>>54428843
What's so ironic is that solutions popular in the Lisp community, when presented in the form of JavaScript, Python, Ruby, etc. are the things everyone complains about, but if you change the syntax to S-expressions, they think it's good. They make fun of NodeOS, but want an OS that acts like a Lisp machine.

>>54429114
Lisp was designed for an obsolete approach to AI called "symbolic AI" which failed and almost destroyed AI. Expert systems don't need to be rediscovered. Everyone learns about them when they learn about obsolete theories.
>>
>>54428712
If you are gonna repost same copypasta from years ago, at least have the decency to write it in quotes.
>>
>>54428749
OOP in C++ is dead.
Good OOP languages like C# rule the world.
>>
>>54429305
Lisp is associated with, but not designed for, AI.

Overpromising and underdelivering caused the AI winter. The big data community is in the process of doing something very similar right now.

After the "be clever by being dumb" approach has played out, elements of expert systems will be reintroduced, and some of the old problems with these will be worked out.
>>
>>54429493
>Lisp is associated with, but not designed for, AI.
Read MIT AI Memo 1.
>>
>>54428749
No, and you're everything that's wrong with the industry if you really think that.

OOP gets a bad rap because hardly anybody understands it. People think "Look ma, dog, cow, and cat inherit from animal. I now understand OOP!" and start writing a huge unmaintainable mess without any semblance of planning or forethought because "le TDD and agile means no architecture or design required" meme (btw, that's a gross misinterpretation of Agile. If you think like that check the links and see it coming from one of the authors of the Agile Manifesto, Robert C. Martin himself).

https://sites.google.com/site/unclebobconsultingllc/home/articles/the-scatology-of-agile-architecture
http://blog.cleancoder.com/uncle-bob/2016/01/04/ALittleArchitecture.html

No dev worth their salt should blindly stick to a single paradigm just cause it's the silver bullet of the month, anyway. Different problems will require different paradigms, and even then, there might have to be compromises to be made where you end up choosing a suboptimal paradigm to approach a problem.
>>
>>54429517
This is a paper about a clever new notation, not about HAL 9000.
>>
>>54429620
>OOP gets a bad rap because hardly anybody understands it. People think "Look ma, dog, cow, and cat inherit from animal. I now understand OOP!" and start writing a huge unmaintainable mess without any semblance of planning or forethought because

So lets say I have a class Zoo and it has a vector of Animal, how do you efficiently loop through each Animal in Zoo to call, say, a virtual function that is different for each inherited class of Animal? I hate it when people shit on inheritance when it has legitimate usages.
>>
>>54429797

Who was shitting on inheritance? I was shitting on people who think inheritance = OOP and people who write code before they think.
>>
>>54429797
>I hate it when people shit on inheritance when it has legitimate usages.
Yet, majority of examples of OOP are wrong usages of inheritance.

Only good example of OOP inheritance is Coffee Maker from Agile Principles, Patterns and Practices. (cant find online link ATM).
>>
>>54428712
love his brutal honesty
>>
>>54428712
I keep hearing from C++ fans and defenders about

>zero cost abstractions
>zero cost

Is there any truth to that?
Because I find it very dishonest and something a salesman would say, not a CS.

How can any abstraction be zero cost? And how can all the crazy abstractions that C++ enables be zero cost? It's like they are saying "lol you can't understand what's going on behind the scenes but trust us, we are smart and the compilers makes zero cost magic things and it will just werk". That's horrifying and that's why I tend to agree with Linus.

At least in C the only abstraction is pointers, it makes sense, and it's a very thin abstraction that maps naturally to assembly (especially with an unoptimizing compiler) and memory. And most importantly C can fit in your head and has a spartan syntax, unlike C++.
>>
>>54430335
Zero Cost abstraction is something the code and compiler knows but that is not in the final executable.

Rust's borrow system is good example. Compiler does huge amount of work, but there is no way to figure out structure's borrow from the executable.
>>
>>54428923
I think Intel uses it for chip design verification, but I'm not 100% sure.
>>
>>54430373
Isn't Rust basically C with "safe" pointers that are implemented using the borrow system?

Or is there more to Rust than that?
>>
>>54430678
Rust is like C with a more modern syntax, more convenient features, and restrictions that guarantee memory safety, type safety, and thread safety.
>>
>>54428712
But I don't like how in c a string must be a char array where in c++ you can just do string = "blah";
>>
>>54430914
typedef char* string;
that's it. 90% of the features people use in C++ are just macros implemented with a pre-processor
>>
>>54430960
There's other things too like C needs %d %s for printing where C++ its just cout << "blah";

It's much less tedious when you have lots of shit to print out.
>>
>>54431111
>C needs %d %s for printing where C++ its just cout << "blah"
if I wasn't sure you're a retarded college student with no actual knowlege of the language before, I am now
>>
>>54431111
Using streams for printing out stuff is retarded, and overloading bitshift-left for something like printing is equally retarded. If you dislike the really simple printf syntax, just use puts and the like
but seriously, printf isn't hard to do

is
 printf("hello %s\n", name); 

really much harder than

 
using std::cout;
using std::endl;
cout << "hello " << name << endl;


Streams are a useful abstraction for some things, printing is not one of them
>>
>>54431111
If C++ was just C with classes and with some smart built-in macros and syntactic sugar it would be a fine language.

But C++ isn't just that. It's the sum of every feature, of every language, it's impossible to hold the whole language in your head, and just when you think you are starting to get it and implement something with it then it blows in your face. Not to mention the dog slow compilation.

C++ sucks
>>
>>54431191
Actually it is much less code to write when you can use namespace std;

It's also cleaner looking.
>>
C/C++ are both horrible and in this day and age should not be used for anything other than kernels / embedded etc.
if you are under the age of 50, and willingly go for C/C++ for anything other than that, you are in fact, an autist, and should definitely consider necking yourself.
>>
#include <iostream>
#include <string>

int main() {
std::string foo = "Hello World\n";
std::cout << foo;
}

vs
int main() {
char* foo = "Hello World";
puts(foo);
}


These will both successfully compile and do exactly the same thing
>>
File: 1455071209586.jpg (13 KB, 620x400) Image search: [Google]
1455071209586.jpg
13 KB, 620x400
http://warp.povusers.org/OpenLetters/ResponseToTorvalds.html
>>
>>54431390
Who wrote this letter and why should I trust their opinions on programming languages more than Torvalds'?
>>
>>54431428
>Appeal to authority
>>
File: 12723487342.jpg (141 KB, 803x688) Image search: [Google]
12723487342.jpg
141 KB, 803x688
>>54431371
>puts(foo)
>>
>>54431459
Do you have a problem anon?
>>
>>54431247
If you're unironically using
 using namespace std; 

then I know you're either trolling or retarded

>>54431459
what's wrong with puts()?
>>
>>54428749
Java + python + c++ +Javascript is most likely >50% of the market.
>>
>>54431475
>>54431480
Nevermind, didn't see the newline in the C++ variant
>>
>>54431448
>reading a 10-page "open letter" to Linus from someone who doesn't even have the balls to sign it
>>
>>54431448
>trusting the opinions of a well established programmer with two incredibly large and respected projects under his belt on a matter of programming rather than an anonymous nitpicker is an "appeal to authority"
Learn what fallacies actually are. I bet if I called you a retard right now you'd meme back "le ad hominem"
>>
>>54431559
Torvalds can hold whatever opinion he chooses. However when he attempts to express that opinion and uses nothing buy fallacies and insults, I have no reason to trust his "authority" on the matter.
>>
>>54428712

abso - fucking - lutely.

C is the way to go.
C++ is just an abomination of four different languages forced in one.
>>
File: le frog meme.jpg (19 KB, 403x195) Image search: [Google]
le frog meme.jpg
19 KB, 403x195
>>54428712
Why not just program C style using C++ and then use whatever nifty C++ components when you need them?

Nobody's forcing you to use C++ a certain way. You can use it as a super set of C if you'd like.
>>
>>54433646
But then you have "expert" c++ programmers shitting on you for not using c++ properly
>>
Try to compile yourself
>>
>>54428712
Linus is a retard. His argument boils down to "Someone _might_ use this badly, therefore it's all automatically bad." His idea of having too many abstractions is just another way of saying he isn't good enough to understand it. People think Linus is a good programmer because of Linux's success. That's dead wrong. He created a project, and millions of other people did the hard labor. He's really just a maintainer with a huge ego.
>>
>>54433782
go write a kernel in C++ then
>>
>>54433697
This is another good point. It's easier to audit a compiler for NSA backdoors if it is written in C to compile C, rather than written in C++ to compile C++.
>>
>>54433901
Well I'm not going to spend a shit ton of unpaid time on one stray /g/ comment, but if you replaced some things Linux has with C++ features.
>>
>>54428712
A lot of substandard programmers use C++ because it's easier and often nicer to work in.
It makes it even easier to shoot yourself in the foot than C though, and you can get some really disgusting looking shit code in it with no effort at all in C++ that would be too much effort to really, truly replicate with C alone.

>>54433695
who cares
as long as your codebase is readable and maintainable, Pajeet can go fuckoff

>>54433782
you know, there's a lot of times where he does this
as an example, his whole argument over HFS+ being bad was that it had case-insensitive filenames (which is a massive gain from a UI point of view, since most users don't give a shit if the file is called "throbbing dicks.mov" or "Throbbing Dicks.MOV", and it simply causes issues with poorly thought up Unix software -- why in god's name is case insensitivity causing your program problems, why in god's name is it using what is effectively the same name twice in the same folder?), and he didn't even go into the fact that it's less resilient to power failure than fucking FAT32 of all god damn filesystems or anything actually important, the fact that HFS+ is a god damn walking timebomb that'll happily fuck your files over

like, I guess he's thinking that "I know what I don't like about this shit, so everyone else should just automatically realize the whole shitpile from this one part I think is really bad at this moment" or something, but it makes him look like a loudmouthed idiot
>>
>>54429305
Except Aaron committed sudoku after Lisp left him
>>
File: 1457845521855.jpg (356 KB, 1166x522) Image search: [Google]
1457845521855.jpg
356 KB, 1166x522
>>54433782
He has a good point, C++ is hard to use in some cases, there's a lot you have to be careful with. I've ready many books on C++ and I still fuck it up. I haven't even gotten around to reading most of the C++11/C++14 stuff either, it's just such a huge language with so many features. You're bound to shoot yourself in the foot sometime. Honestly, I think it has too many features/keywords/etc. I'm a pretty average intelligence guy so that's probably my problem, but a lot of people in the work force are.
>>
>>54431390
This letter is autistic and rambling as fuck
>>
>>54431371
Second one's much smaller though, both in LOC and binary size.
>>
>>54428712

That's why i'm learning Python instead.
>>
>>54431390
>As for efficiency, I dare to claim there are cases where the opposite is true (ie. C++ encourages more efficiency than C). This is a very typical code you will see made by the average C programmer:
for(i = 0; i < strlen(line); i++)
{
...
doSomethingWith(line);
...
}

WAT? Why would anyone do this instead of just iterating using the pointer, which is way more intuitive?
>>
>All those pajeets that can't in to C++ in this thread
Thread replies: 69
Thread images: 5

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.