Live data from Hacker News

Cheerp – A C/C++ compiler for web applications

leaningtech.com

51–54 of 54 posts

Re: Cheerp – A C/C++ compiler for web applications

#51
post #30
post #28

Earlier quoted context omitted.

Bjarne has always maintained that C++ is (mostly) backwards compatible with C. And that's what most people mean by C/C++.

I know that C++ is mostly, but not entirely, backwards compatible with C. That doesn't answer the question of what "C/C++" means. They're two different languages. The problem is that different people mean different things by "C/C++". Some people mean "C and C++"; others just seem to be unaware that they're distinct.

Cheerp, like clang (upon which it is based), can compile both C and C++ files.

Re: Cheerp – A C/C++ compiler for web applications

#52
post #36

Earlier quoted context omitted.

Nasa and military don't know what they're doing? C++ is the go to language in mission critical systems.

NASA and military are using a whole lot of different technologies and languages, including, but not limited to assembly, C, C++, ADA, Haskell, Coq, Python and Java. Saying they use C++ for correctness, when they are using Coq or Haskell as well, is again - exaggeration. I believe they use C/C++ more for performance / low memory overhead rather than its correctness related features.

[deleted]

Re: Cheerp – A C/C++ compiler for web applications

#53
post #26
post #19

Earlier quoted context omitted.

> it's all JavaScript so performance is rather moot point If that was the case, http://asmjs.org/ wouldn't be a thing.

According to the Chrome guys...it isn't a thing [0][1], and I tend to agree. They've kept up, and often exceeded FF, IMO, for real code by making a better JIT compiler. They still haven't implemented asm.js and yet their "naive" approach to asm.js style code is on par. [0] https://code.google.com/p/v8/issues/detail?id=2599#c53 [1] http://mrale.ph/blog/2013/03/28/why-asmjs-bothers-me.html

I'm not a compiler expert but I also have the feeling that a new bytecode would be better.

But if I recall correctly, there are very good reasons why we don't have that in our browsers; security concerns maybe? Anyone?

Or http://hn.algolia.com, here I go again!

(What a great post, thanks for linking. Even though I follow mraleph on twitter, I had never opened his website. Probably because it all looks like scary compiler stuff.)

Re: Cheerp – A C/C++ compiler for web applications

#54

Earlier quoted context omitted.

Writing for correctness in a language with no memory-safety, weak type system and, till not very long ago, no standardized memory-model, and UB in every other paragraph of the specs? Good joke. If they are really doing this, they have no idea what they are doing. There are plenty of languages better for safety-critical systems than C++; even widely hated, boring Java is much better.

It's a bit off topic, but I'm being descriptive (based on professional experience) and not normative when I say C++ (and C and Ada) are used for safety-critical software. Javascript and functional languages certainly aren't. The vagaries of the standard aren't issues since safety critical software is validated on a per-platform and per-compiler basis. Memory safety is certainly a concern during the development proces…

> GC languages (like javascript and Scala) do not have provably (for some value of provably) deterministic execution times

This is not unique to GC languages, but any languages with dynamic memory management. C++ new/free and STL abstractions built on top are not provably deterministic either. And if you program without ever touching dynamic memory (statically allocating and pooling everything) then GC is not a concern.

> I say that to say the zero-cost abstractions of C++ is a huge benefit when writing safety-critical software.

You're talking about performance now, not correctness. All those benefits get lost once translated to JS.

Post reply on HN