Celebrating 30th Anniversary of the First C++ Compiler: Let's Find Bugs In It
New submitter Andrey_Karpov writes: Cfront is a C++ compiler which came into existence in 1983 and was developed by Bjarne Stroustrup ("30 YEARS OF C++"). At that time it was known as "C with Classes". Cfront had a complete parser, symbol tables, and built a tree for each class, function, etc. Cfront was based on CPre. Cfront defined the language until circa 1990. Many of the obscure corner cases in C++ are related to the Cfront implementation limitations. The reason is that Cfront performed translation from C++ to C. In short, Cfront is a sacred artifact for a C++ programmer. So I just couldn't help checking such a project [for bugs].
I'm sure I got a PDP-8 somewhere in my back closet.
Or features :
https://www.youtube.com/watch?...
aaaaaaa
...a bug in and of itself.
"Sacred Artifact"? Are you kidding?
I will happily agree that the language and compilers were both pretty awful back then. The worst warts have been beaten out now, and it's a pretty capable language in the main but this is now. 1990s C++ was horrible.
I think C++ was great when it was the best tool we had, but it's time is past now that we have more modern tools and techniques.
The basic problems with it are (1) it is wildly arcane, (2) it is an unmanaged language that gives low level access without adequate tools to guard that access. The problems with this have been glaringly obvious over the past decades, with buffer overruns in C++ code one of the biggest security headaches of the last decades.
Some argue that "really really good programmers don't do that", but actual history proves them wrong, and even if it was true, most programmers are not in the upper 1% who might be able to do that. We need tools that normal programmers can use safely.
C++ isn't much taught in universities any more so it will die out. It had a good run, but times change, and the world moves on. Good to look back and see where we came from though - those who don't understand history are condemned to repeat it,a s they say
What a better place the world, and thousands of CompSci 101 classes, would have been.
This "new submitter" is the "science adviser" of the company who wrote that blog post, of which the main point is to sell you their product.
Before C++ came around, wasn't C just a glorified macro assembler?
I don't think C++ can have bugs at all as it's not an implementation. It could have unspecified conditions, but not bugs. A C++ compiler would likely contain plenty of bugs, but those bugs would be when the compiler does something else than expected of the C++ standard. Looking for bugs in C++ itself would be like looking for bugs in the English language. It might not always be the best and most logical solution, but there aren't any bugs. There are plenty of user errors though.
Boost.
For those who can't figure out how to do something badly on their own.
1979 - Work on "C with classes" started
At that time, "Object Oriented programming was considered too slow, too special purpose, and too difficult for ordinary mortals."
Well, I'm glad C++ fixed that last problem!
I have been there through most of this glorious ride. It is a little disappointing that after all that time programmers can't agree on a good, universal string class, and numerics (matrix, vector, complex numbers). Scheme is still a better way to program a computer.
C++ can have, and has had, bugs.
The standard for C++ could specify something impossible, for example. Like, make std::string impossible. This is similar to having a program that fails to compile, but as the standard is interpreted, it only causes problems when someone actually interprets it.
It could also have mistakes (as opposed to bugs), like mandating that your sort routine take at least O(n^3) time.
You can examine the defects and fixes in the C++ standard; they are published publicly. A defect is usually fixed by compilers even when compiling in prior version modes.
Translating to C would not impose a limitation on the language features of C++, its possible to generate whatever C code you need to support C++ features. Using an LALR parser would introduce limitations on language design, however. This was once very common.
CFront wasn't a compiler, it was a preprocessor that spat out C code that was subsequently compiled by whatever C compiler you happened to have.
Looking at CFront output was the best way to understand how C++ actually worked at the time, since it was all mapped to pretty straightforward C constructs. I don't think anyone around today knows what a vtable and ptable is, but back then it was how you could tell the programmers who really dug in to the language from those that didn't.
I remember when it first came out. Back in the days of BBS's
The old joke was
"Have you seen the new C+++"
I wonder how many will still get the joke?
I don't know if it was CFront, but the first C++ programs I wrote were for homework assignments in the late 1980's. The compiler output was unreadable, of course, because it wasn't compiling my code. It was compiling a C++ to C translation of my code. All I really knew was that there was a problem with my program *somewhere* at the line, or above it, where the first error message appeared. It was an exercise in agony management.
I remember thinking, "what an awful language!" at the time. Of course that changed eventually; I remember Borland's C++ compiler being especially good at producing helpful error messages.
Uh, have you heard of smart pointers?
Yes, and the pre-C++11 std::auto_ptr was a confusing piece of crap.
Or RAII?
Isn't that the trade group that sues music fans? Oh wait, that's RIAA. But yes, I understand the advantages of automatic finalization.
Have you used C++ in the last 5-10 years
Last 4 years would be more honest, as C++11 added the smart pointers and other things that make modern C++ feel like modern C++.
I am going to bet you that the 3B2 was that primary computer architecture for cfront.
However, it does appear that cfront was extremely portable:
I don't remember what the ptable was for anymore either.
I do remember name mangling, which I suppose doesn't happen anymore?
It's a pre-processor that translates C++ to C, that then has to then be compiled by a C Compiler. Back in the day, I used the Glockenspiel implement of CFront that then used the Microsoft C Compiler (this was before Microsoft had a C++ compiler) to compile the resulting C code to .obj files to be linked by Microsoft's LINKer.
No, let's not OK? Really.
I would rather sever one of my own fingers than spend time searching for bugs in an old and obsolete piece of code. No matter how "sacred" you think it is, it's just another legacy system to me. And searching for bugs seems like one of the least interesting, least relevant activities you could do with legacy code. How about evaluating it's architecture? How about a critique of how the ability and features of the legacy system fit with the times? But a bug search??
I could add some unkind comments about needing some purpose in your life. Yet people find meaning and interest in the oddest things. The thing that's even odder though, is feeling the need to publicize this deeply eccentric hobby. What's next, a discussion of the giant ball of belly-button lint you have in your closet?
Seriously, this is getting old.