Live data from Hacker News

C Minus Minus

en.wikipedia.org

11–20 of 75 posts

Re: C Minus Minus

#11

One of the criticisms I have heard of C-- is that it doesn't distinguish between integer and floating-point data in the type system. There are some architectures where that wouldn't be a problem, but most modern CPUs have completely separate integer and floating-point data paths, with a performance penalty for shuffling data between them. Generating good code on these systems from C-- source requires more effort than…

Modern architectures have different register banks for the two, but that's irrelevant, C-- is not register-centric.

Re: C Minus Minus

#13

One of the criticisms I have heard of C-- is that it doesn't distinguish between integer and floating-point data in the type system. There are some architectures where that wouldn't be a problem, but most modern CPUs have completely separate integer and floating-point data paths, with a performance penalty for shuffling data between them. Generating good code on these systems from C-- source requires more effort than…

Modern architectures have different register banks for the two, but that's irrelevant, C-- is not register-centric.

Isn't the point of C-- to be an IR, easily compileable to assembly on the target?

Re: C Minus Minus

#14
"Ah, it'll be a joke programming language. Someone probably made a joke about C++ and then someone with too much time on their hands actually wrote an implementation of the language."

(Reads the page.)

"Oooh. Interesting."

Re: C Minus Minus

#15

So now any wikipedia page is now worthy of a hackernews post?

To see how silly that comment is, compare to: "So now any web page is now worthy of a hacker news post?" The answer to both comments is the same, and is in the HN guidelines.

Re: C Minus Minus

#16

Earlier quoted context omitted.

Modern architectures have different register banks for the two, but that's irrelevant, C-- is not register-centric.

Isn't the point of C-- to be an IR, easily compileable to assembly on the target?

No the other way around - easily emittable, letting the backend in turn do the heavy lifting to lower it.

Re: C Minus Minus

#17
post #6

The problem with things like this is that "compile to C" isn't really just done for ease of implementation, but for sheer portability - individual C compilers are widespread, and the totality of them are basically ubiquitous. The Quick C-- compiler mentioned in the article only supported x86. So the only way I would see something like this work, is as a frontend for an existing compiler. LLVM itself makes this kinda…

https://takenobu-hs.github.io/downloads/haskell_ghc_illustra... shows how it (well, the Cmm fork) is used to compile Haskell code with GHC

GHCs Cmm is an interesting beast. It changed a bit from C-- and it doesn't seem to be "sold" outside of the Haskell market, but it does feature basically the best of all worlds: A native generator targeting most current platforms, a LLVM backend (resulting in basically the same platforms, but maybe with different performance characteristics), and even a compile-to-C option.

Re: C Minus Minus

#18
post #4

I'm familiar with a different C-- developed by Peter Cellik which appeared before the language in the article (1997). But the article has no mention of it. The discussion page of the article does mention there used to be many languages called C-- with similar ideas and the article only talks about a specific one

You probably mean Sphinx C--: https://bkhome.org/archive/goosee/cmm/

Re: C Minus Minus

#19
post #9

Slightly related to this, this article made me check Simon Peyton Jones's wiki page [1], where I saw this: > Jones has played a vital role in the development of new Microsoft Excel features since 2003, when he published a paper on user-defined functions.[19] In 2021, anonymous functions and let expressions were made available in the Office 365 version of Excel as a beta feature.[20] Truly, there were (possibly still…

He semi-joked that Excel is the world's most popular functional programming language.

Re: C Minus Minus

#20
From an engineering point of view, it’s interesting they chose to implement their own intermediate language, as opposed to just sticking to LLVM IR and “outsourcing” the problem of code generation.

I actually researched this some time ago, and was a bit surprised to learn that modern GHC’s intermediate representation seems to differ from what the C-- paper describes quite substantially, in ways that are only described in the source code. They’re still using the same name though.

One observation is that GHC has been somewhat slow to adopt new CPU targets (M1, WebAssembly). I wonder if the reliance on C-- played a role in that.

Post reply on HN