Standard C++ Moves Beyond Vapor 415
An Anonymous Coward++ writes "This google thread announces the first C++ compiler that can actually handle the whole language (we'd been waiting for half a decade here). The company that did it is EDG. They're a tiny outfit, but they're apparently also behind the Intel compiler (both on Windows with Visual C++ extensions, and on Linux with GCC extensions). There are rumors they can compile the Linux kernel too."
10? (Score:3, Funny)
1998. Ten years, eh? Oh wait- what year is it again?
Re:10? (Score:2)
Re:10? (Score:2, Offtopic)
Welcome to slashdot, where moderators with -1 offtopic rubber stamps run wild, 'tis a dangerous land for sure where triggerhappy moderators prey on those that dare stray from the path even by an inch.
So I'll use my +1 bonus on this just for the hell of it and watch as they get their panties in a bunch from the exitement of knowing that they may deal their fearsome moderation not once, not twice, but three whole times before this post draws it last breath and disappears into the unseen -1 land, let my demise serve as an example, fear the -1 offtopic modders!
C+_ (Score:3, Funny)
Yeah, well done, 'editors'
- S_D
Has Karma to blow
linux kernel (Score:3, Funny)
Finally!! Someone pulled it off!
GCC is missing stuff? (Score:4, Interesting)
(I had to write this three times because of that damn 20 second after reply widget. Thanks, trolls.)
GCC code is slow as molasses (Score:2, Informative)
I code computationally intensive number crunching code and I had to buy Intel's compiler for Intel and Compaq's compiler for Alpha just to get some performance. And I'm talking about 10-20% difference.
Re:GCC code is slow as molasses (Score:4, Informative)
GCC code is slow.
I code computationally intensive number crunching code and I had to buy Intel's compiler for Intel and Compaq's compiler for Alpha just to get some performance. And I'm talking about 10-20% difference.
Then you should like GCC 3.1. Here is a snippet from the changelog (you can see the entire list of changes at http://gcc.gnu.org/gcc-3.1/changes.html [gnu.org]):
Re:GCC code is slow as molasses (Score:2)
Re:Stop Blaming MS Software Bugs! (Score:2)
Re:GCC is missing stuff? (Score:5, Informative)
Re:GCC is missing stuff? (Score:5, Informative)
You'd be amazed at how much has been missing. Mainly the STL stuff, but there's some bugs in templating in some compilers too.
It sucks when you try to write portable code in C++ and you end up not being able to use some cool stuff because not all compilers support it. A friend of mine switched to Java specificly because of this.
Re:GCC is missing stuff? (Score:3, Informative)
I don't think gcc is missing any of the STL stuff anymore (or rather the includes and libg++). GCC does have trouble with some of the "new" namespace stuff, and some edge cases in the type system can do the wrong thing (however they are far enough on the edge that maybe I was wrong about them, not gcc).
Well that is the nice thing about pushing all the complexity into the libraries (yes Java is a more complex language the C...but less then C++ or Perl). Hmmm, speaking of Perl (or even Intercal...) it is also an advantage of really only having one implementation too...
Re:GCC is missing stuff? (Score:2)
I beleve you....but...I think simplicity is only one part of the equation. There are two other big factors.
C++'s standard frequently races ahead of any and all implmentations (i.e. there is no rule that youhave to actually try something before you add it to the standard!). The other languages you brought up...and many many other languages (APL for example) tend to grow by exparamenting, and deciding how much benifit people get from the work once they know how hard the work actually is! Granted if the group that did it is working on a comercial implmnetation then there is a strong motivation to try to convince others that this is a fine addition, and easy to do too. It is still better then never having any compiler with partial specilation (or whatever) and deciding that is now a standard feature.
The other reason is the size of the prize. As far a sI know there is little if any money to be had from implmenting python or scheme, and there is clearly no money to be had from doing it poorly. For the most pary you get pride from doing a good job, and you might manage to make a little bank from it too, but not much. C++ is different, compilers are in haigh demand, mostly good ones, but with enough demand you can produce poor ones pass them off on unsusspecting fools and make real money (Visual C++ anyone?).
I will also mention I used a C (not C++) compiler in the late '80s that didn't support the whole language -- this was pre K&R so it was even a pretty simple language. What did they leave out? The struct keyword, and with it, all structures. It basically sucked. So you can make a crappy implmentation of any language.
I do freely admit though that if C++ were simpler, it would be implmented more fully more offten. There are a lot of features it has that I never use and could gladly see go (multiple inhartance, with or without virtual base classes for example). On the other hand there are features that I thought were of minimal value that I have seen used soooooo well that I have totally changed my mind (overloading for example, which I finally came to apreciate with the STL).
Re:GCC is missing stuff? (Score:2)
"Testing C++ Compilers for ISO Language Conformance" (Dr. Dobb's Journal, May 2002). This article introduces a Python framework that uses example code from the standard. Article and partial code available [clemson.edu]. Compilers include: GCC 3.0, 2.96, 2.95; Borland 5.5; VC++ 6.0.
"C++ Conformance Roundup" (C/C++ User's Journal, April 2001). This article, referenced by the previous article, analyzed results from Dinkumware [dinkumware.com], Perennial [peren.com], and Plum Hall [plumhall.com]. Compilers include: IBM, Sun, Metrowerks, Intel and KAI, MS, GNU, Borland, and Comeau.
Re:GCC is missing stuff? (Score:2, Informative)
Re:GCC is missing stuff? (Score:2)
Just because it is not recommended yet does not mean that it does not work. I have been compiling the kernel with gcc 3.x when 3.0.3 came out with good results.
Charles
Re:GCC is missing stuff? (Score:3, Insightful)
Besides, even if it WAS in C++, most likely it would just use features that the compiler could handle.
You mean usenet (Score:2, Insightful)
Re:You mean usenet (Score:4, Funny)
Re:You mean usenet (Score:2)
Uhm. Here, I must disagree with you. They didn't "Buy the USENET" in the same way that it is impossible to "Buy the web" or "Buy Email."
They did, however, successfully purchase an archive of the last twenty years of USENET posts, and currently archive all USENET posts made today. Their copy/mirror of USENET is called "Google Groups."
what am I missing? (Score:2, Interesting)
every c++ compiler is different (Score:3, Informative)
They all don't properly implement different parts of the standard, which leads to all sorts of cross platform issues.
It's about time someone has done something about it. EDG is no small name in the compiler world either..
Re:every c++ compiler is different (Score:2, Interesting)
Then:
a) It's not ISO C++ compliant code: you should sell them, or throw them out, or burn them, or something.
or
b) It's a regression in GCC. In which case you should report it to the GCC team. They are very concerned with regressions, and work hard to make them go away (the release of 3.1 is currently blocked on a small handful of regressions)
Given that it's a textbook, and textbook code is usually pretty trivial, I'm leaning highly towards (a) as the correct answer.
ISO C++ broke a lot of old (pre-Standard) C++ code. Them's the breaks. But I've written a ~18K line C++ program (using modern features like the STL, dynamic_cast, etc) that runs on egcs 1.1.2 up to gcc 3.0.4, and over half a dozen commercial compilers, including VC7. Portability is entirely possible, it just needs some care, just like it does with C or Perl.
Re:every c++ compiler is different (Score:4, Informative)
Which, overall, is a good thing. I should note C doesn't either - the C ABIs are specified by systems people. For example, there is a System V ABI for x86, which is basically what all the Unix versions on x86 use.
So I guess that this is a good step towards compiler compatibility, but linking will probably still be a problem.
There is now an official IA-32 C++ ABI. Nobody has done it completely, but GCC and Intel are supposed to converge on it in the future. There has also been an IA-64 C++ ABI since the start, though AFAIK some incompatibilies still remain between different compilers (but they are working on it, I think).
Re:every c++ compiler is different (Score:2, Informative)
To be a bit more specific, it's an ABI for IA-64 Unix systems that use the ELF object format.
That's an awful lot of qualifications, but they're necessary. (And not just for C++.) Even such simple things as function calling conventions differ from platform to platform, and linkers are a lot less trivial, and involve a lot more design choices, than most people realize.
Re:every c++ compiler is different (Score:2)
Not much (Score:4, Interesting)
However, it is nice to see that they have made it in. Maybe now other groups will start imlementing the full language, too.
Missing Features List As Of Last Year (Score:5, Informative)
Mozilla C++ Portability Guide (Score:3, Informative)
Re:Mozilla C++ Portability Guide (Score:2, Informative)
Re:Mozilla C++ Portability Guide (Score:3, Informative)
Re:Mozilla C++ Portability Guide (Score:2)
I really dislike portability guides like that.
We're using C++, but we're not supposed to use templates, exceptions, RTTI? Am I allowed to use a class, or do I have to write pure C with a .cpp extension, FFS?
That sort of limitation was relevant five years ago. Today, the vast majority of compilers on all major platforms handle the vast majority of such functionality quite happily. Most rules banning templates, exceptions, etc. are out of date and inappropriate for the target readership. Don't use particularly devious template tricks, sure; it'll be another couple of years before it's safe to use Alexandrescu-esque techniques in code that must be portable across several compilers. But banning templates altogether (and presumably the whole STL and IOStreams libraries with them)? That's just silly.
Re:what am I missing? (Score:2, Informative)
Re:what am I missing? (Score:2, Interesting)
Re:what am I missing? (Score:2, Informative)
Compile THE KERNEL ???? (Score:2, Interesting)
OMG, i have been programming the device drivers in C !! 8-o
Re:Compile THE KERNEL ???? (Score:2, Informative)
Re:Compile THE KERNEL ???? (Score:2)
Ahhh (Score:2, Funny)
Re:Ahhh (Score:3, Interesting)
Which is the exact reason I've moved pretty much completely to Objective-C. After cursing C++ for years, I've finally found peace with a C-like, object-oriented language that makes sense. I learned Obj-C when I was getting familiar with OS X development, and I haven't used C++ on anything since, on any platform. Obviously, I still have to maintain plenty of C++ code, but as time goes on, that amount will become less and less and eventually, I'll be rid of C++ forever!
Re:Ahhh (Score:2)
It is a compelete hack around C, its the slowness of Smalltalk, with a syntax as ugly as C++ and even worse.
Move to Python, Smalltalk or Lisp instead.
Re:Ahhh (Score:2)
The Language is Complicated (Score:2, Insightful)
If you want to see some of the really weird thigns you can do with the language, check out Andre Alexandrescu's "Modern C++ Design." You might also want to look at the signal system that gtk-- uses. Yes, it can lead to a twisty maze of templates, but it also affords some very powerful type checking, which I miss when moving to languages like Scheme or Java.
Re:The Language is Complicated (Score:2)
That at least use to be true. In interviews the guy that designed the STL (Steponov?) shocked Stroustrop -- he didn't think anything like the STL could be implemented in C++ (and it turns out he was partly right, there were some minor language changes to make the STL work, and some bigger changes to make it work better/be simpler to implement).
I'm just forced to add "Me too!" here. I miss gtk--'s signal system when using ObjC or pretty much anything else...and Modern C++ design is just chock full of interesting ideas that will totally drive maintance programmers apeshit.
Re:The Language is Complicated (Score:3, Insightful)
Quite true... if memory serves me right in The C++ Programming Language Stroustrup actually says he does not consider himself an expert at C++. It's pretty much humanly impossible (IMHO) to know the entire language and make proper use of it 100% of the time. I smile to myself everytime I see young programmers fresh out of college calling themselves C++ experts.
Re:The Language is Complicated (Score:2)
Re:Ahhh (Score:2)
C++ syntax makes perfect sense. There are no arbitrary relationships. As a multi-paradigm language it allows you to choose a subset of features for a given product, depending on what you need.
You do not need the STL to write C++ code. However, you are crazy not to use it, becuase they are generally excellently implemented collections useable in any program... and the STL is an elegant flexible system. Like most great feats of software engineering you have to think it's way to get it to work, and then it is your friend.
I'm starting to get a big laugh forming for all the complaints of C++ just being too darn hard. Why do I not find it hard? Do I know restraint? Do I just get it? Bad taste? Infinite wisdom?
I can but wonder, will I lose or gain karma for speaking well of noble C++!
Re:Ahhh (Score:2)
Bless you. As far as I am concerned, C++ is still the greatest open standard we have. There will always be "best of breed" languages which are stronger in their own field of affairs: its hard to beat Perl for text, or Haskell for maths. But as a resolutely general-purpose language, which is owned by nobody except its users, C++ remains the first and best of its kind.
I still don't think we have explored even half its potential: it'll be interesting to see what contribution a truly standard-compliant compiler makes to this.
Re:Ahhh (Score:2)
C+_ (Score:2, Funny)
C-O-N-spiracy
From Later in the Thread (Score:5, Informative)
to add a code generator, libraries, support tools, etc. to produce
a complete compiler package. (We use the Edison front end for our
compiler product at Concurrent, so hopefully we'll have all these
nifty features someday - but everyone should be sure they don't
interpret this casual comment as an official promise - I don't even
work on the compiler
I dont know how right this guy is, and I have no expertise in the area myself... but isn't this exactly what we're doing with this slash story? Interpretting this comment as an official promise?
More information: what this really means (Score:4, Informative)
<sigh>Once again my story gets rejected when it contains more info than the one that gets posted. :-(
To set the record straight, EDG [edg.com] do indeed produce C++ front end compiler tools, and it is these that have just been released.
However, major C++ vendors including Comeau Computing [comeaucomputing.com] use that in their compilers. Comeau already have a beta of their 4.3.0 compiler available at their on-line compiler [comeaucomputing.com]. The full version is due later this month.
Dinkumware [dinkumware.com] have also announced a version of their standard library implementation to work with Comeau, which should be available shortly after the Comeau compiler is released. Apparently, it makes extensive use of export, but for little change in performance at compile-time.
That makes their new library implementation a bit academic as far as Joe Developer goes. However, it's excellent news in general, because it shows that using export isn't going to entail a performance hit. We can finally write template code with interface and implementation properly separated out.
Sun and Java vs. C++ (Score:3, Interesting)
Great. (Score:2, Funny)
The man page for gcc is bad enough... They could write something like "I love VB" somewhere in the midst of the thing and no one would ever get that far...
Hmm.
No linux kernel compile, sorry (Score:2, Informative)
Also, linux (kernel) uses a bunch of (proprietary to GCC
You need to realize that most low-level stuff isn't written in C++ (ie kernels, device drivers, TCP/IP stack, Apache, Perl, Python etc). C++ simply does not have the efficiency. I'm not saying C++ is slow, just that it isn't suitable for that kind of programming.
Re:No linux kernel compile, sorry (Score:2)
You need to realize that most low-level stuff isn't written in C++ (ie kernels, device drivers, TCP/IP stack, Apache, Perl, Python etc). C++ simply does not have the efficiency. I'm not saying C++ is slow, just that it isn't suitable for that kind of programming.
Uh.. I don't really agree with that. There is no inherent slowness in C++. Consider that many of the larger C projects use C in a kind of OO way (ie. structs with function pointers can be thought of as objects). There is no speed advantage in executing a function via a pointer in a struct compared to executing a non virtual method in a C++ object. The difference is that in C++ the compiler does a lot of the work for you behind the scenes, thus saving your time. The reason C is used lies mainly in the fact that many programmers are more used to it than C++. And for the projects you mention, they were all started quite a long time ago, when the GNU C++ really was nothing to cheer about. And also that C compilers exist for more platforms than C++ compilers, so if maximum portability is your priority number 1, plain C may be a better choice.
In fact, I remember there were some discussion on the python mailing lists that a future version of python should perhaps be implemented in C++. Apparently it turned out that Jython (the implementation of python in Java) is a lot cleaner than the classical Cpython, largely because the OO features in Java made a much cleaner design possible.
Re:Actually C++ is MORE efficient that C (Score:2)
The control thing probably sounds like a red herring, but in kernel land knowing exactly what your code is doing is extremely important - every cycle really does count. Particularly in the core kernel, you often see strange and confusing constructs that are in there simply because they've been shown to produce faster code. And this isn't some kind of he-man "I can write more gotos than you!" crap - people actually sit down and look at the asm output from bits of code and decide which version is best.
That's the main reason why the kernel is so conservative about what compilers it builds on - there's code in there that relies on specific behaviour of gcc extensions to achieve the exact results desired. This probably sounds like a bad thing, but this is an OS kernel - performance is
Kernel coding is
himi
A replacement for C++ (Score:3, Funny)
I'm a first year programming student at an Ivy League school and I've just finished my Visual Basic classes. This term I'll be moving onto C++. However I've noticed some issues with C++ that I'd like to discuss with the rest of the programming community. Please do not think of me as being technically ignorant. In addition to VB, I am very skilled at HTML programming, one of the most challenging languages out there!
C++ is based on a concept known as Object Oriented Programming. In this style of programming (also known as OOPS in the coding community) a programmer builds "objects" or "classes" out of his code, and then manipulates these "classes". Since I'm assuming that you, dear reader, are as skilled at programming as I am, I'll skip further explanation of these "classes".
Please allow me to make a brief aside here and discuss the origins C++ for a moment. My research shows that this language is one of the oldest languages in existance, pre-dating even assembly! It was created in the early 70s when AT&T began looking for a new language to write BSD, its Unix Operation System (later on, other companies would "borrow" the BSD source code to build both Solaris and Linux!) Interestingly, the name C++ is a pun by the creator of the language. When the first beta was released, it was remarked that the language would be graded as a C+, because of how hideously complex and unwieldy it was. The extra plus was tacked on during a later release when some of these issues were fixed. The language would still be graded a C, but it was the highest C possible! Truly a clever name for this language.
Back to the topic on hand, I feel that C++ - despite its flaws - has been a very valuable tool to the world of computers. Unfortunately its starting to show its age, and I feel that it should be retired as COBOL, ADA and Smalltalk seem to have been. Recently I've become aquainted with another language that's quite recently been developed. Its one that promises to greatly simplify programming. This new language is called C.
Although syntactically borrowing a great deal from its predecessor C++, C greatly simplifies things (thus its name, which hints at its simpler nature by striping off the klunky double-pluses.) Its biggest strength is that it abandons an OOPS-style of programming. No more awkward "objects" or "classes". Instead C uses what are called structs. Vaguely similiar to a C++ "class", a struct does away with anachonisms like inheiritance, namespaces and the whole private/public/protected/friend access issues of its variables and routines. By freeing the programmer from the requirement to juggle all these issues, the coder can focus on implementing his algorithm and rapidly developing his application.
While C lacks the speed and robustness of C++, I think these are petty issues. Given the speed of modern computers, the relative sluggishness of C shouldn't be an issue. Robustness and stability will occur as C becomes more pervasive amongst the programming community and it becomes more fine-tuned. Eventually C should have stablity rivalling that of C++.
I'm hoping to see C adopted as the de facto standard of programming. Based on what I've learned of this language, the future seems very bright indeed for C! Eventually, many years from now, perhaps we'll even see an operating system coded in this langauage.
Thank you for your time. Your feedback is greatly appreciated.
Re:A replacement for C++ (Score:2, Interesting)
Wow, good use of plagarism!
Info available on EDG's website (Score:4, Informative)
Supported C++ and C Language Features [edg.com]
This page also says:
--xPhase
It's a pity that the standard is broken. (Score:4, Insightful)
It's too bad that the standard itself is broken...
In case you're interested: The issue is a deceptively fine point in constructor/destructor semantics. The current standard allows behavior that massively breaks a bunch of stuff you'd have been able to do if it had required behavior that conformed with the rest of the philosophy of the language. It is this:
You have a class base class with,
a virtual member function and,
a constructor that,
exports a copy of the pointer to the instance under construction (which is stored externally), and
a derived class with,
a member variable of a class-with-construction type, and
an overriding of the virtual function, and
the constructor of the derived class's member variable (or something it calls, or some other member-variable initialization) gets hold of the pointer and,
calls the virtual member function.
Does it get the base class version, derived class version, or go wonky?
Similarly during DEstruction of the member variables (i.e. after the derived class destructor but before the base class destructor).
My claim is that the standard SHOULD explicitly specify the behavior as follows:
The result of a virtual member function call is defined from the execution of the first line of any constructor of the class through the execution of the last line of the destructor, at the most-baseward class where the virtual member function has a defined behavior (unless a more derived class overrides the function to again be pure virtual, and this is allowed).
The result of a virtual member function call to a virtual member function that is overridden in a derived class is the derived class behavior if the function is called during or after the execution of the first line of any constructor and before or during the execution of the last line of the destructor (unless a more derived class overrides the function again), the base class behavior if called before the first line of a derived class constructor or after the last line of the derived class destructor.
In other words: Member variable constructors/destructors (and everything else executing at that time) "see" the base class.
Instead we have this: With respect to calling virtual member functions during construction the early language definition and first ANSI standard said the behavior was undefined. The "final" standard essentially says "don't do that". I'm not sure what current compilers do. But when I checked about ten years ago, of the four binary combinations of whether constructors and destructors got it "right" or "wrong":
cfront (and cfront-derived compilers at Sun and SGI) got it "wrong" one way.
three compilers for PCs got it "wrong" a second way.
g++ got it "wrong" the third way.
Now the semantics I've described are very powerful and create a consistent object model.
Up to the beginning of the user-written code of the constructor through the end of the user-written code of the destructor the instance is a collection of components - base classes, member variables - which have their own internally-consistent behaviors. It is wrong to execute the derived-class member function, because the derived class instance doesn't exist yet. But it is right to execute the base-class member function, because the base class DOES exist and IS initialized.
After the execution of the constructor and before the execution of the destructor the derived-class instance is a fully-constructed and initialized member of the derived class. It might later be hammered into a new shape by serving as a component of a more-derived class, but for now it's consistent.
During the constructors the components are pulled together into a whole, and during the destructor they're disassembled into their components. But the constructors and destructor are aware of the state of the assembly, and can use care not to let a derived-class virtual member function be executed until everything it depends on is ready, or co-operate with it by passing it flags to inform it of construction progress.
I won't go into all the things this enables. But I will note that it would make C++ more consistent and more powerful for object-oriented programming than other contenders, which also do this "wrong". (For instance: Smalltalk has the derived-class ("subclass") behavior during the base-class ("superclass") construction. This risks breaking the consistency of already-debugged construction code whenever a method is overridden and requiring those coding to constantly recheck code outside their new class' modularity boundary.)
Since the behavior I want is a legal option within the standard, perhaps the Edison Design Group might be willing to give me a compiler switch or pragma ("object_construction_semantics"?) to cause their compiler to generate it?
Pretty please?
Re:It's a pity that the standard is broken. (Score:2)
Also note that anyone trying to do complex construction semantics (e.g., virtual initialization) or interaction with objects (e.g., registering this with another object registry and throwing multiple, possibly virtual inheritance into the mix, and trying to deal with the brokenness of various complilers there is only one workable solution: two-phase construction. [tantalon.com]
For example:
Re:It's a pity that the standard is broken. (Score:2)
In other words:
When a virtual function is called from the constructor of the derived class it MAY get the behavior of its own class or it MAY get the behavior of the base class.
Which is even more broken than I described.
I claim the standard SHOULD say that a constructor or destructor MUST get the version of the virtual function that is a member of ITS OWN class - the class of which this constructor or destructor is a part. It gets a BASE class virtual function if and only if there is no overriding definition in this class.
(A constructor / destructor and a virtual member function OF THE SAME CLASS can interact through a member variable so the member function can selectively delegate to its base class version if necessary. A constructor/destructor can NOT interact with the BASE CLASS version of the member function to promote its behavior.)
On the other hand, when the virtual function is called from the mem-initializer for a member object, I claim the standard SHOULD require that it MUST get the behavior of the BASE class version of the member function. More importantly, I claim that the constructors and destructors of MEMBER OBJECTS of the derived class should also invoke the BASE class' version of the virtual member function.
(A derived-class virtual member function will typically depend on member state that has not been fully initialized. And it can not even defer to the base-class version because it can't trust the state of any member variable to flag the necessity.)
Of course the standard is correct in saying that it should NOT get the behavior of a further-derived class of which the class containing the constructor, destructor, mem-initializer, or member object is a base.
This is not how GPL works (Score:2, Informative)
So can this compiler finally handle THIS... (Score:2)
/* Foo.h */
template<class T>
class Foo {
public:
Foo(void);
void doSomething(void);
T bar;
};
/* Foo.cpp */
#include"Foo.h"
template<class T>
Foo<T>::Foo(void) {
template<class T>
void Foo<T>::doSomething(void) {
/* main.cpp */
#include"Foo.h"
int main(int argc, char *argv[]) {
Foo<int> *foo;
foo=new Foo<int>();
foo->doSomething();
}
EDG's role (Score:4, Informative)
It says something about how complex C++ syntax has become that this is the case. It's very hard to parse C++, because you have to do extensive declaration handling to find out what's a type name, and you have to know what's a type name just to parse. C++ is thus context-dependent.
One major implication of that context-dependency is that you can't parse a C++ text file without processing the include files. This is why tools like "indent" are hard to find for C++. "Little" tools for C++ are rare. And that hurts the language.
I'd like to see a cleanup of C++, but it's not going to happen. Most of the action in the C++ standards effort is going into adding obscure features for fancy templates. As a result, C# and Java are gaining market share.
ObjC (Score:3, Interesting)
Although I agree with the OSS crowd that Java should also be opensourced, it is at least a standard and this is a godsend for someone learning the language. In C++ the problem with learning it is whose version do you learn? Microsoft's? GCC? What are the fine points of symantic differences inbetween the differing versions? ObjC has this problem as well but since it's only heavily used on OSx at the moment it is not so critical, but if GNUStep were to more successful for instance there might arise differnces there as well (infighting over GCC ObjC compilation with Apple etc). I personally wish for more standards in these heavily used languages although I don't suppose it'll happen anytime soon.
Baby's birthday (Score:2)
Yawn! (Score:3, Interesting)
Java has at least a coherent standard. And Common Lisp has been there for almost 20 years now.
It's funny to watch the members of the C/C++ Gestapo wet thier pants over this. I bet Bjorne is doing a double-take right about now.
A REPLACEMENT FOR C++ (Score:2, Funny)
I'm a first year programming student at an Ivy League school and I've just finished my Visual Basic classes. This term I'll be moving onto C++. However I've noticed some issues with C++ that I'd like to discuss with the rest of the programming community. Please do not think of me as being technically ignorant. In addition to VB, I am very skilled at HTML programming, one of the most challenging languages out there!
C++ is based on a concept known as Object Oriented Programming. In this style of programming (also known as OOPS in the coding community) a programmer builds "objects" or "glasses" out of his code, and then manipulates these "glasses". Since I'm assuming that you, dear reader, are as skilled at programming as I am, I'll skip further explanation of these "glasses".
Please allow me to make a brief aside here and discuss the origins C++ for a moment. My research shows that this language is one of the oldest languages in existance, pre-dating even assembly! It was created in the early 70s when AT&T began looking for a new language to write BSD, its Unix Operation System (later on, other companies would "borrow" the BSD source code to build both Solaris and Linux!) Interestingly, the name C++ is a pun by the creator of the language. When the first beta was released, it was remarked that the language would be graded as a C+, because of how hideously complex and unwieldy it was. The extra plus was tacked on during a later release when some of these issues were fixed. The language would still be graded a C, but it was the highest C possible! Truly a clever name for this language.
Back to the topic on hand, I feel that C++ - despite its flaws - has been a very valuable tool to the world of computers. Unfortunately its starting to show its age, and I feel that it should be retired as COBOL, ADA and Smalltalk seem to have been. Recently I've become aquainted with another language that's quite recently been developed. Its one that promises to greatly simplify programming. This new language is called C.
Although syntactically borrowing a great deal from its predecessor C++, C greatly simplifies things (thus its name, which hints at its simpler nature by striping off the klunky double-pluses.) Its biggest strength is that it abandons an OOPS-style of programming. No more awkward "objects" or "glasses". Instead C uses what are called structs. Vaguely similiar to a C++ "glass", a struct does away with anachonisms like inheiritance, namespaces and the whole private/public/protected/friend access issues of its variables and routines. By freeing the programmer from the requirement to juggle all these issues, the coder can focus on implementing his algorithm and rapidly developing his application.
While C lacks the speed and robustness of C++, I think these are petty issues. Given the speed of modern computers, the relative sluggishness of C shouldn't be an issue. Robustness and stability will occur as C becomes more pervasive amongst the programming community and it becomes more fine-tuned. Eventually C should have stablity rivalling that of C++.
I'm hoping to see C adopted as the de facto standard of programming. Based on what I've learned of this language, the future seems very bright indeed for C! Eventually, many years from now, perhaps we'll even see an operating system coded in this langauage.
Thank you for your time. Your feedback is greatly appreciated.
Egg Troll
Re:KAI have had this for years. Not news. (Score:3, Informative)
Re:Compile the kernel? (Score:2, Informative)
Re: Some Issues This Brings Up (Score:2)
One half keystroke compiles, the other half installs.
Actually it's one keystroke as you need to hit return.
alias m="make menuconfig"&&"make dep"&&"make bzImage"&&"make modules"&&"make modules_install"&&"make install"
does it in 1/3 of a keystroke.
Re:Their product is only a front end (Score:2)
They won't. They never have. They don't need to. Other people pay them a *lot* of money to do it. In particular, I know that KAI C++ and Compaq's C++ compiler are both based on EGD. Probably there are 3 or 4 others, at least.
EGD is a damn good optimizing compiler, too. I generates code that beats about anything out there.
Re:Their product is only a front end (Score:3, Informative)
Yes, KAI and Compaq use the Edison front end. So do Comeau, SGI, Intel, and a number of other compilers. See EDG's site [edg.com] for a more complete list.
Some of EDG's customers will release a compiler based on the new front end sooner than others, partly for business reasons (every company has different tradeoffs) and partly for technical reasons (for some companies, a new front end means an awful lot of integration work).
I expect Comeau [comeaucomputing.com] to be the first company to sell a compiler based on the new EDG front end: Greg Comeau has been very excited at being able to support export. I'll be surprised if it takes longer than a few weeks for the new Comeau compiler to come out.
Re: We need an engineer who knows the whole langua (Score:4, Informative)
I won't stoop to your pulling numbers out of the blue, but I would contend there is a great deal of scientific and research software that also need every bit of speed they can get. These programs alone must constitute way more than the 1% you have allotted. The software I am developing is in that category.
Finally, when you speak as you have, you declare your ignorance loudly. Yes, C++ does not prevent you from making the kinds of mistakes that you refer to; but by learning good engineering techniques, you can avoid and prevent them yourself. Languages which do restrict you in this area *cough*java*cough* also restrict your creativity and power to accomplish your task. A civil engineer for example, uses techniques -- not restrictions -- to make his/her designs infallible; it is time software engineers step up to the plate and begin using solid techniques rather than blame the language.
That being said, it is still important to use the right tools for the job, if speed is not a concern and you can acclompish the task with something safer and easier -- do it! C++, however is going to remain an important and key tool to accomplish many tasks in the future. Its speed, ability, and flexibility will assure its long life.
Re: We need an engineer who knows the whole langua (Score:2)
I said most of the time , even within one program designers rarely need maximum speed at every point. My point is that the defaults of the language are almost uniformly dangerous. 95+% of the time, switch statements should not fall through; what's with making falling through the normal behaviour? I should put a 'nobreak' in to stop it breaking, not the other way around. I mean sure, I almost always remember it... these days... ;-)
Yes, C++ does not prevent you from making the kinds of mistakes that you refer to
No language can do that. C++ is the equivalent of a machine shop with no guards around any of the machinery. Sure, after you've been cut a few times you learn to move in a way that avoids the sharp bits; but here's an idea, why aren't there guards around them, that you can remove if you are doing something that needs them out of the way?
Languages which do restrict you in this area *cough*java*cough* also restrict your creativity and power to accomplish your task.
Oh yeah right. Lack of creativity and power. ;-) You must be the worst software engineer in the world if the language is getting in your way like that, but I don't buy that, you sound like you almost know what you're doing. But what's that smell? It's the Bull.
Re: We need an engineer who knows the whole langua (Score:2)
This claim has no factual basis.
switch statements should not fall through; what's with making falling through the normal behaviour?
Using switch statements in C++ is not "default behaviour". They are rarely used, and serve mostly as a C compatibility tool. switch can nearly always be replaced by table lookup or polymorphism, and both of these things (tables and polymorphic objects) are supported by the language.
but here's an idea, why aren't there guards around them, that you can remove if you are doing something that needs them out of the way?
C++ was not designed from scratch, it was constrained by C compatibility. For the most part, this is the reason. Basically, getting rid of "sharp bits" wasn't the primary goal of the language.
Re: We need an engineer who knows the whole langua (Score:2)
This claim has no factual basis.
What? No? As in none at all? Lack of a garbage collector? No array bounds checking? No constraints on pointer arithmetic? Automatic type casts usually with no compiler warnings?
C++ was not designed from scratch, it was constrained
I prefer the word 'damaged'
by C compatibility. For the most part, this is the reason. Basically, getting rid of "sharp bits" wasn't the primary goal of the language.
You mean it's an eyesore, but because we know why, that's ok then?
Look I've lived at the sharp end of the language more than most. I've worked on multi-million lines of embedded, persistent, realtime code much of it in C++, and without the benefit of the STL. Trust me when I say C++ has some major issues. I've also sometimes had to maintain less clueful peoples code... all I can say is: yuck.
Re: We need an engineer who knows the whole langua (Score:2)
>>My point is that the defaults of the language are almost uniformly dangerous.
>>This claim has no factual basis.
>What? No? As in none at all?
You said the defaults of the language are uniformly dangerous. A single example, or even multiple examples of dangerous aspects of the language does not support this claim, because (a) you'd need to show that these dangerous facets are "default" in some sense, and (b) you'd need to argue this for everything that's a "default" (whatever that means).
Lack of a garbage collector?
That's not a "default". It's a feature that the language doesn't have. It doesn't in any way support the "uniformly dangerous" hyperbole above.
No array bounds checking?
See std::vector. Use bounds checking if you like. In some applications (matrix arithmatic), I've found that bounds checking results in a 50% performance hit, so I'm glad that the language doesn't nanny me.
No constraints on pointer arithmetic?
Pointer arithmatic is not "a default". It's actually something you shouldn't need very often.
Automatic type casts usually with no compiler warnings?
Well, learn to use your compiler, and turn the warnings on.
I prefer the word 'damaged'
Use whatever word you like, but there are very good reasons for making the language C compatible. C compatibility is a two edged sword. On one hand, you inherit messy syntax and dangerous code. On the other hand, you also have compatibility with existing software systems, and a language framework suitable for developing high performance software.
You mean it's an eyesore, but because we know why, that's ok then?
No, it's an eyesore, because it makes tradeoffs. The tradeoffs (elegance/performance and compatibility) might not be "pretty", but purity and beauty are not design goals of C++. Solving real world problems is.
Look I've lived at the sharp end of the language more than most. I've worked on multi-million lines of embedded, persistent, realtime code much of it in C++, and without the benefit of the STL. Trust me when I say C++ has some major issues
So, why didn't they use java or smalltalk or LISP for that embedded, persistent, realtime code ??? I think you know the answer-- those languages make tradeoffs that make them more or less useless for embedded or realtime applications. On the other hand, the tradeoffs that C++ makes -- namely, tradeoffs in favor of compatibility and performance -- have a lot to do with the fact that you are using it for these things.
Re: We need an engineer who knows the whole langua (Score:2)
>>This claim has no factual basis.
>What? No? As in none at all?
You said the defaults of the language are uniformly dangerous.
No I equivocated. I said almost. And I stand by it.
So, why didn't they use java or smalltalk or LISP for that embedded, persistent, realtime code ??? I think you know the answer--
Yes, I know the answer ;-)
those languages make tradeoffs that make them more or less useless for embedded or realtime applications.
Bzzzzt. You lose. Actually we've redesigned it to be a mixture of Java and C, and ditched C++ entirely... The submillisecond hard realtime stuff is C, and Java is perfectly fine for soft realtime, and embedded. I understand that LISP or Smalltalk have been successfully used in similar situations as well.
Re: We need an engineer who knows the whole langua (Score:2)
Gee do you think? Perhaps you'd do that. We didn't. We were/are actually using classes extensively, some people (I count myself in this, I have been OO'd for more than a decade) actually know how to write them. We didn't do any compiling C with the C++ compiler either; we had two compilers that interworked fine.
Java isn't used for the realtime stuff, because you can't implement real time software when you have non-deterministic garbage collection.
Actually, we aren't doing this, but IRC; garbage collection issues can be avoided in Java. If you allocate memory ahead of time you can avoid triggering the garbage collector entirely. We were actually having to do the same thing in C to avoid fragmentation. Most of our soft realtime has response times of upto 2 seconds. Hard realtime is down to about a millisecond and has deadlines you have to meet.
Anyway modern incremental garbage collectors run plenty fast enough for soft realtime...
Re: We need an engineer who knows the whole langua (Score:2)
Where did I say that?
But all this can be addressed by using object oriented code and STL.
Well, I certainly don't agree that switch statements disappear in sensibly written OO code, in fact absence of them is a sign of an inexperienced designer. Using polymorphism for that impacts both readability and speed, and implies a use of inheritance that is quite detrimental. Nearly all new OO designers misuse inheritance.
If you allocate memory ahead of time in C++, most of these "safety" issues that you complain about can also be avoided.
What colour is the sky in your world?
Re: We need an engineer who knows the whole langua (Score:2)
No, its very easy to support. You or I can write an entire book on the very obvious failings of C/C++ syntax. But, quite frankly I just can't be bothered here. You show no signs of being experienced enough with C++ and other languages to begin to appreciate it; plus in a few months all of these posting will be deleted. Only when you've learnt 20 or 30 computer languages and used atleast 10 in anger does it become clear just want went wrong- and what didn't (there's lots of good things about C/C++ too.)
Oh, ok, one more unbelieveably trivial example. Consider 'int'. What size is it? Yeah I know, its undefined 'for performance reasons'. WTF? What this really means is that a very significant fraction of programs are non portable; sure they might work, but as the size of the program grows, the probability approaches zero. If they had defined 'int' to be 32 bits, and created a different type, say 'nativeint', then only if you really need the performance would you use it. If you understand enough to know you want performance you use it. If you don't understand enough- I don't want people who don't understand what they are doing using 'int'. The standard language defaults are almost uniformly unnecessarily dangerous... and yes theres that equivocation again.
Re: We need an engineer who knows the whole langua (Score:2)
Whether a switch is slow or not is both compiler and processor dependent; although most compilers don't optimise this much, switches are usually slow. But I don't see what that has to do with the syntax of the language.
so while your idea of using a nobreak option instead is intriguing, I personally like the way C++ encourages you to think about your switch statements to code them more efficiently.
So you like the naked sharp spinning things because the pending death concentrates the mind? You're perverse if you don't mind me saying.
You can always just use if-then-else-ifs to avoid the fall through problems when you don't want to think about what you are doing.
You could, but that's horrible.
Re: We need an engineer who knows the whole langua (Score:2)
>>>>
Umm, it's actually scientfic fact that sharp spinning things concentrate the mind. Thing about it: when are you most attentive? Going 95mph on the freeway, or sitting in traffic going 15mph? Danger does sharpen attention.
Re: We need an engineer who knows the whole langua (Score:2)
Re: We need an engineer who knows the whole langua (Score:3, Insightful)
That's more to do with algorithms than anything else. You can make almost anything faster with a better algorithms, and the two ings: caching and hashing. I bet you anything not one of those programs use the best algorithm.
Re: We need an engineer who knows the whole langua (Score:2)
Re: We need an engineer who knows the whole langua (Score:2)
I think the latter is more likely, no matter how much we might wish otherwise. Almost all of the slow programs we use are slow because of dumb code (from simple implementation gaffs up to complete architectural clusterfucks) and that's a language independent "skill".
Re: We need an engineer who knows the whole langua (Score:2, Insightful)
Uh? C does that, unless you code REALLY carefully. C++ - unless you choose to use it simply as a C compiler - gives you the tools to eliminate precisely those irritating errors. Well-designed classes give you the ability to move to a higher level of abstraction so that stuff isn't even on the agenda. Even cursory knowledge of strings, vectors and maps/hashes allows you (in my own experience) to get at least one order of magnitude more reliability into your software and with exception handling, provides the mechanism for dealing with the errors when they do occur.
If you choose to use a C++ compiler to compile C, then there is little point. Moving up to what (IMHO) C++ was intended to provide puts you somewhere different altogether. But the idioms are different entirely; idiomatic C++ is a *very* different language from C. It's not perfect (it's far too big) but if you need a C-like tool and care about reliability and freedom from overruns, memory leaks and the like, it's a very good tool for the job. And it's a lot easier to get stuff right up at that abstraction level too. You get the airbags and ABS braking
Re: We need an engineer who knows the whole langua (Score:2)
Re:Anyone Can Claim Standards Compliance, Prove It (Score:5, Informative)
Well, P.J. Plauger did post on the thread: "The new EDG front end passes all the tests in the Dinkum C++ Proofer." I'd say that's a pretty good start.
Re:What is "standard?" (Score:2)
Hey! I just finished reading that book too!
It also has a chapter on C portability problems, and is quite instructive with regards to shell portability as well. C++ is hardly alone when it comes to quirks.
Oh, and that book also considers "make uninstall" to be a "not a very useful feature."
Re:What is "standard?" (Score:2)
Re:What is "standard?" (Score:2)
Re:Using the NULL pointer feature in C++ (Score:2)
Do you need VB to troll? (Score:2)
I get so flabbergasted that I'm actually speechless when I see some say that the BSD licence is harsh. Or that GCC is obscured. Not only this but you have the sources of Java in every JDK downlowd and this troll actually thinks that the world is going to suddenly switch to VB??? And he hasn't actually ever coded in C++?? Has he coded at all I ask myself, because it seems he's actually better at repeating Microsoft press propaganda statements than anything else.
The Google Thread (Score:2)
I know it's kinda off-topic, but I need to know how you guys get that "google thread" thing.
Whenever I search the groups.google.com, even under the "thread mode", I get something like
http://groups.google.com/groups?hl=en&threadm=52f
instead of
http://groups.google.com/groups?hl=en&th=e653fbdb
So what has I done wrong ?