Live data from Hacker News

Linus Torvalds on C++

harmful.cat-v.org

181–190 of 190 posts

Re: Linus Torvalds on C++

#181
post #166

Earlier quoted context omitted.

C++ (and other mainstream languages, for that matter) excels in the aspect that you can actually write useful software with it. Yet, to the date, there are exactly zero useful pieces of consumer software (e.g. browsers, office suites, video processing) written in lisp. Thus, I suggest that lisp zealots stfu about C/C++ already, and either fix their favorite language or invent a new one.

Yeah, of course, right... that's why we have Lisp programs on space probes [1], PS2 games written in Lisp [2], PG's Viaweb, Maxima [3] among others, ITA Software, Emacs, StumpWM, and a ton of other stuff I can't remember right now. Ah not to forget AutoCAD. I don't give a flying fart whether it's "consumer" software or not. A ton of useful software has been and is written in Lisp dialects and there are a lot of appli…

Ah, "blub"... the trusty indicator of a brainwashed pg fanboy. Look, I know that something has been written in lisp, still it is not the kind of software that people use (directly or indirectly) every day and you know it. Plus, you're just being disgustingly arrogant by indirectly saying that your precious lisp is too good to be used for the mundane, everyday software development.

tl;dr: lisp zealots are funny and arrogant

UPD: FYI, AutoCAD is NOT written in Lisp, it just supports extensions written in a dialect of Lisp.

Re: Linus Torvalds on C++

#182
post #89

But no one can deny that c++ is the most fascinating programming language in this world. You can either spend or waste as long time as you want to __LEARN__ this language and never can say I understand ALL.

I deny it. http://en.wikipedia.org/wiki/J_(programming_language)

C++ occupies an interesting point on the curve of fascination vs. utility, but to call it the most fascinating language (by your own definition especially) is just hyperbole.

Re: Linus Torvalds on C++

#183

Earlier quoted context omitted.

Everything that C is, C++ is as well. The single simple feature that I don't have to declare all my variables in the beginning of the method but where it's actually used is enough to kick the ass of C to the curb. Then there's the rest of the features including the little thing known as OO... To object against C++ with the argument that incompetent coders can do bad things... well, it's nonsense. Incompetent coders c…

The single simple feature that I don't have to declare all my variables in the beginning of the method but where it's actually used is enough to kick the ass of C to the curb. You're about twelve years outdated: https://en.wikipedia.org/wiki/C99

Also, you could declare variables at the start of any block in C, not just the start of a function, prior to C99.

Re: Linus Torvalds on C++

#184
post #78

Earlier quoted context omitted.

There's a large faction in AAA games that thinks C++ is a stupid idea. It's debatable who's right in that debate, but good points are being raised. The problem is not so much that C++ is a worse language than C - it's that it makes it insanely easy to shoot yourself in the foot in hideously complex ways that take forever to unravel. See e.g. two phase name lookup - http://blog.llvm.org/2009/12/dreaded-two-phase-name-…

I might suggest taking a look at D. It's more or less C++ redesigned from the ground up by a C++ compiler writer, so it's much more consistent and a lot more pleasant to program in. I've had bad experiences with the third-party libraries, which were sometimes inconsistently documented and half-finished on account of the still unfortunately small community, but the standard libraries are excellent, especially everythi…

D _was_ decent until D2.0 started to get a serious case of feature envy. I'm not too happy with that new direction.

Re: Linus Torvalds on C++

#185
post #183

Earlier quoted context omitted.

The single simple feature that I don't have to declare all my variables in the beginning of the method but where it's actually used is enough to kick the ass of C to the curb. You're about twelve years outdated: https://en.wikipedia.org/wiki/C99

Also, you could declare variables at the start of any block in C, not just the start of a function, prior to C99.

Still didn't make it a good idea though.

Re: Linus Torvalds on C++

#186
But Mercurial was written in Python and performance is comparable to git. So, his argument is not correct about the performance reason on choice of C over C++. Even interpreted Python which was used in Mercurial was not speed bottleneck. Yes, I know that most of speed critical sections was written in C. But almost all project in Python.

Also Darcs was written in Haskell and Bazaar with Python.

I hate C++ too (over 10 years of experience). But Linus is full of BS too.

Yes, choice of C language in Git is right choice. But source code of Git is horrible and unmaintainable mess.

Re: Linus Torvalds on C++

#187
post #179

Earlier quoted context omitted.

You can pretty much Know C inside of ten years of using it professionally. I swear after twenty years of using C++ I still come across things I've never seen before, the rabbit hole very deep indeed. Now with the new C++ there's a ton of new stuff to absorb.

30 years in, and I still discover new things about C, every six months or so. Granted, they're usually pretty subtle.

There's never a hope of knowing 100%, but it is reasonable to be familiar enough to know 80% with ten years of experience and 95% with twenty. By thirty if you're the kind to take knowing your toolset seriously, 99% is possible. That last 1% is the "you can't be serious" aspect of the C standard.

Re: Linus Torvalds on C++

#188
post #149
post #145

Earlier quoted context omitted.

He probably means he uses a C++ compiler, but the only C++ feature used that isn't also in plain C is the namespace syntax. This makes it easier to package up code into modules, since you can have namespace foo { bar } and namespace baz { bar }, without worrying that the two bar symbols will collide.

That's correct, and I use GCC for this. For some time I've also used m4 to pre-process namespaces and output C99-standard code. That would be my preferred way when I can get away with it because C++ compilers introduce uncanny little differences that can haunt you in some hedge cases, but it adds an extra step and then I'm doing something that doesn't work in the outside world. For me, the biggest argument against C+…

I'm interested in your comment about m4. I've never really used it except for sendmail configuration. The idea of using it to pre-process namespaces is interesting.

Would you mind expanding on how you set things up and what you do to use m4?

Re: Linus Torvalds on C++

#189
post #166

Earlier quoted context omitted.

C++ (and other mainstream languages, for that matter) excels in the aspect that you can actually write useful software with it. Yet, to the date, there are exactly zero useful pieces of consumer software (e.g. browsers, office suites, video processing) written in lisp. Thus, I suggest that lisp zealots stfu about C/C++ already, and either fix their favorite language or invent a new one.

Yeah, of course, right... that's why we have Lisp programs on space probes [1], PS2 games written in Lisp [2], PG's Viaweb, Maxima [3] among others, ITA Software, Emacs, StumpWM, and a ton of other stuff I can't remember right now. Ah not to forget AutoCAD. I don't give a flying fart whether it's "consumer" software or not. A ton of useful software has been and is written in Lisp dialects and there are a lot of appli…

FWIW Emacs's core is C and extensions (the vast majority of the code) are in Lisp. This is a common model for dividing up the work between "engine" and personalization/customization stuff and I think it works well. But it's not true that it's a "Lisp program", or not solely one anyway. Not unlike AutoCAD...

Re: Linus Torvalds on C++

#190
post #188
post #149

Earlier quoted context omitted.

That's correct, and I use GCC for this. For some time I've also used m4 to pre-process namespaces and output C99-standard code. That would be my preferred way when I can get away with it because C++ compilers introduce uncanny little differences that can haunt you in some hedge cases, but it adds an extra step and then I'm doing something that doesn't work in the outside world. For me, the biggest argument against C+…

I'm interested in your comment about m4. I've never really used it except for sendmail configuration. The idea of using it to pre-process namespaces is interesting. Would you mind expanding on how you set things up and what you do to use m4?

Sorry for not responding to this earlier, I just missed it.

In m4 I simply created some sort of preprocessor that renamed variables to have some sort of prefix depending on namespace. I haven't used this for a good while because then I have the issue that MSVC doesn't support other modern C99 things that I consider basic unless you compile in C++ mode, thus negating this. At work I need MSVC compatibility...

Hope you get to read this.

If I were to do this again today, I'd use OMeta. Give it a look, it's dead simple if you have the time to read through it.

Post reply on HN