Monday, September 25, 2023

The new C++ compilers

Among the pages I'd looked up when summarising the Unity fracas were pages about C++. I recalled that Q_rsqrt isn't awesome anymore, even compiled as "unsafe" maybe in Rust. So - why not? - because life is different for a now-a'day C++ programmer than it was when I was almost failing COMP 212 at uni.

C++ (and Rust) is like most languages compiled. Back when Gene Loves Jezebel were still cool, C++ compiled to assembler. At uni, it compiled to something just high-enough above assembler that it wouldn't destroy an expensive Sun / Solaris workstation when you (well, I) ballsed it all up. We took assembler classes too, in COMP 210. I think that even in x86 32-bit, C++ compiled close to the metal; hence why id Software had to plunder 1970s papers on doing /√.

Nowadays C++ yea verily unto Rust really doesn't compile to assembler anymore, "unsafe" or not. It compiles to something that links-together instruction sets. One reason: multiprocessing. We want program X, like an Unreal Tournament remaster, not to hog it all up from such program Y as, er, Windows herself. But C++ is still better - compiled closer-metal - than, say, C#. Although C#'s libraries, like Unity and even (I think) System.Numerics, are often done in C++ below-the-hood.

As to the best compilers these days: obviously I'm noo hear. I hear that open-source has been beating back the compilers done by the major corporations, opposite from game-engines where Unity and Unreal are years ahead of Godot. We used Gnu's "GCC" in the early 1990s; GCC is still around. CLang is Gnu's competitor here. Most other companies, like Embarcadero, are atop (in this case) CLang. Microsoft now allows a CLang compiler alongside its own. I don't know what's even happened to Borland.

Anyway, if you have some maths you'd like optimised, it were best to hunt up a library, since these are smarter with the newer processors, whilst you're probably assuming a 8086 16-bit DOS system.

BACKDATE 9/29

No comments:

Post a Comment