Latest Proposals for C++0x 911
CodeDemon writes "It looks like the ISO/IEC JTC1/SC22/WG21 working group has made some headway in reviewing new proposals for the C++ language. The long anticipated upgrade for C++, C++0x, may be just around the corner. Head on over to check out the proposals yourself."
Re:where does the name come from? (Score:5, Insightful)
learn from Java (Score:3, Insightful)
Re:Anonymous array members (Score:5, Insightful)
I suppose this is what happens when you allow a programming language to be designed by a committee...
Re:Anonymous array members (Score:1, Insightful)
More on D (Score:5, Insightful)
One of the stated goals on the
In short, it really *is* time to move to D.
Re:Whatever. (Score:2, Insightful)
hehe.. sorta (Score:5, Insightful)
With that said, it's an extremely powerful and flexible language. Very much more powerful than Java or C#. The complexity is mostly due to its flexibility. You can do (almost) anything with it. Of course, we can argue whether that's good or bad.
I think C++ can learn from Java though. The default should be to pass all non-built-in-type function parameters by const reference and the programmer has to specify otherwise (basically opposite of the way it is now). That would clean up the code a whole lot since 99% of the time that's what you want anyway. And the standard C++ library should have some sort of garbage collector available.
Another problem I have with C++ is that even with all its power you have no way to get to the "left hand" variable of operations. For example, if you have a matrix class you can overload the "+" operator so that you can do things like "matrix3 = matrix1 + matrix2". However, that's not going to be very efficient (assuming that's why you're using C++ in the first place) because there is no way to get to the matrix3 variable from inside the + operator. That forces you to use a temporary variable to add the two matrices then copy by value the whole matrix after adding matrix1 and matrix2. There are tricks around this problem but none are clean.
Uh, no. (Score:5, Insightful)
Everyone but you, friend.
The language C was descended from the language B, which was descended from the language BCPL. Dennis Ritchie never decided whether C followed B because it was alphabetical (in which case C++ would have been D), or whether C followed B because it was the next letter in BCPL (in which case C++ would have been P).
As for the C++0x thing, it's quite common to call languages by the year of their standardization, thus "FORTRAN77", "FORTRAN90", "C89", "C99", "C++98". The next cycle for C++ will be completed sometime in the next seven years, but we don't know exactly which year, so "0x".
Again, uh, no. If it doesn't look "exciting," perhaps you're simply looking at the wrong proposals. Or perhaps you simply still think of C++ as "C with more type checking, and those // comments."
The routine standards adjustment came in the form of "TC1", which was just recently published. Basically, "C++98.0.3p4rc2", to put it in Linux terms. Just bugfixes. C++0x is a different story.
(And I don't know that I'd call Perl 6 particularly innovative, either.)
Re:Whatever. (Score:5, Insightful)
Straight C is my favorite tool and what I use for embedded programming, quick hacks and performance constrained work. Every time I try to do a large application with it though, I find myself thinking "you know, they already did this exact thing with C++, and I'm going to spend 2 days re-inventing this and testing it".
I use tidbits of Assembly (80x86, MIPS, Arm, PowerPC, what have you) in embedded systems for device driver or performance critical sections. As a HW engineer I tend to use this a lot in bringup of new designs, especially "very new" designs that don't necessarily work and every instruction is important.
I use C++ when I am building a very large, flexible application where I use many types of data structures and need it to get up and running in a short period of time. I like this language for "serious application" programming.
I use Perl to manage my file system, do text processing and other maintenance hacks.
I use Java for simple GUIs that often work as a front end for serious endeavors.
I use TCL/TK for ASIC/FGPA debugging (simulator interface) and test suites.
I use fortran less and less (often I convert to C) for purely numerical computation. Gems of knowledge exist in fortran code for optimized matrix related algorithms that are highly useful in 3D visualization.
I have not found any practical use for Pascal or Lisp lately (the latter is useful for emacs, but I rarely mess with it).
The point of all this is that much like you wouldn't use a screwdriver to drive a nail through wood (unless that was all that was available), you would tend to use whatever tool is best suited to a task. Us engineer types are supposed to be tool-makers and users of the highest order. It surprises me when I hear one of us suggest we should use our favorite tool to the exclusion of all others.
I do not like C++ in terms of the performance and memory impact it infers, but when building large applications I do not have time to re-invent a linked list for the umpteenth time, nor do I want to debug every different link list in my code, there are much harder problems to solve more critical to the success of my project. That said, C++ (and C for that matter) is lacking in some very important things. Among those I think are critical are: multithreading, network stack framework (platform independent that is) and GUI framework (platform independent!). If you read the article, you'll see mention of at least two of those things (we need a standard platform independent GUI library dammit!)
Re:More on D (Score:2, Insightful)
Noooooooo! (Score:5, Insightful)
Re:OOP (Score:3, Insightful)
Java is a great example of a language that forces OOP on programmers. Most universities are starting students on Java because there are a lot fewer ways to get things done in the language. But experts know how to use the parts of the language that they need, and if C++0x took that power away from them they'd look elsewhere.
Making small changes to C++ to do things like get it closer to merging with C and improve weaknesses in the library like smart pointers are worthwhile and will directly benefit programmers. I don't understand your logic that any changes have to be large and basically change the nature of the language.
Re:Great... (Score:3, Insightful)
If the upgrade was so expensive, you shouldn't have done it. We're still using MSVC 5 for some products, and MSVC 6 for most of the rest. Some small *new* products are now being developed in MSVC.Net, but we have to consider the cost of having code that might not be portable to older versions of the compiler. The cost of upgrading the older products cannot be justified, so we still use what works.
Re:What C++ really needs to do (Score:5, Insightful)
The IDEs do also cater to the business community, probably why you don't see more Perl. The fact is "business software" is usually just glue, and Perl/Python/Java/VB/tcl will always be better glue then C++, because they were DESIGNED to be glue and C++ was designed to be the bricks and mortar.
What I would really like to see in C++ would be compile-time exception enforcement ALA Java. I mean Jesus, when you are trying to work with a class library they can't even document what functions may throw what [apache.org], how the hell are you supposed to write robust code? In Java this documentation comes for free when you write the function, and is forced to be correct by the compiler.
Re:Lack? (Score:3, Insightful)
Instead of leaving it as "undefined", they should define it as "If compiled with array range checking so and so exception should be thrown with the name of the variable and line (given debugging info is one)" or something...so that at least it is USEFUL.
Re:learn from Java (Score:3, Insightful)
Re:More on D (Score:3, Insightful)
Yeah, we need a java-like syntax so you too can create lots of debug info in programs with 'if (global_debug==1) ' rather than the infinitely more efficient #ifdef DEBUG.
I think some people have problems with practical features of the language - sure, we can make it 'elegant' (like they read somewhere that java was), ignoring the fact that people use the language to get the job done. If you want to make C++ easier - stop using it! Go get yourself a copy of Visual Basic if you don't want the features C++ offers. You *do* want those features, then learn it, just like all the other C++ programmers have done before you. Too bad that the newbies have to, *gasp* understand what they have to do to make the code work, that they can't just knock up a program in a half-hour without any thought involved. Possibly this is one of the best features of C++ - you can't have any old monkey programming it, not without being found out straight away.
Re:More on D (Score:1, Insightful)
Re:So does everyone else. (Score:2, Insightful)
Default parameters and function overloading. Both encourage lazy programming and, more importantly, hide bugs.
Re:Great... (Score:3, Insightful)
Re:Noooooooo! (Score:5, Insightful)
Re:More on D (Score:3, Insightful)
I'm pretty sure Java guarantees that if the conditional of an if is known at compile-time (as it would be in this case), then the if will be optimized out of your code. Just like an #ifdef. So, nice straw-man, but the two constructs are equally efficient.
Re:Useful for structs/unions (Score:4, Insightful)
Why? (Score:3, Insightful)
I recently started messing with Squeak [squeak.org] and I think that it is the kind of thing programming language should try to mimic: an easy to use, very dynamic environment. Let's take computing to a new level, leave the 90s behind please.
Re:Useful for structs/unions (Score:3, Insightful)
What is C++ used for? (Score:1, Insightful)
Clearly, C++ has many features for libraries, and these support what I think of as infrastructure/middleware kinds of applications. Just link your code to a C++ library and access all sorts of other features. It may or may not do a good job of this, but it is clearly part of the charter of the language.
The real issue is if C++ is a systems programming language: is it actually used for classical system programming tasks? I think not. Let me give examples:
1. Language implementation. Are any languages actually implemented in C++? For all the open source software I have seen, C is the language used for almost all language implementations. Unless there has been some big change GCC is written in C, I think. Is VC++ or the Intel C++ compiler written in C++? Is this a historical issue, or is there some reason that language implementers stick to C? For a counter example, there are many LISP systems written in LISP using meta-circular implementations.
2. Operating systems. I know of no operating systems written in C++, and I doubt that it is possible. C++ assumes a lot of support exists for memory management and tasks like interrupt handling. When you are in this domain, you have to be very strict about memory allocation and deallocation, and C++ often implicitly creates objects on the fly. You would have to code in a very non C++ style to keep from constantly going into and out of storage allocation.
3. Real time and embedded programming. All the problems of operating systems along with code bloat and possible speed problems due to method overhead.
Does anyone have counter examples? Are there other typical systems areas where C++ is not the right choice? I'm not trying to start a flame war, I really want to get intelligent meaningful feedback.
Re:It's great to see some metaprogramming related. (Score:3, Insightful)
One reason C is so popular today is that it reached a critical threshold in abstraction: it isn't assembly code. C can be learned very quickly, and, given that prior programmers weren't too supidly clever, C-based programs can be easy to learn. I say "stupidly clever" because some people really do try to shoehorn functions into structures (oooo...I make C object-like) or use the preprocessor as if they have to, because it's there.
C, used as intended (structures and functions that use structures), is actually quite refreshing to program in. You know, even Motif (a C library) isn't all that bad, as long as it is used directly without resorting to compulsive-big-clever-framework-because-I'm so-smart-syndrome.
If you haven't caught on, I don't care for programmers who are so caught up in their genius that they invent these beasts of programs just to make them feel like they are architecting a space station or something. Usually, these are people just out of college, or "experienced" folk too stubborn to see their outside of their fantasy micro-universe. People need to realize that other people have to work with that code, too!
Re:hehe.. sorta (Score:2, Insightful)
This sort of statement bugs me. It's a bit like saying that a Ferrari and a Tyco R/C are equally powerful, because they can both be used to drive a weight load from the house to the grocery store and back.
The fact of the matter is that there's a little more to it than Turing equivalence. Sure, you could write a massively OO object exchange system in Assembly, or a language metaparser in Visual Basic, or just about anything in Befunge. They're all turing equivalent. For that matter, so is morse code to an interpreter with an abacus over tin cans and string.
That said, in the real world we need reasonable tools to facilitate development. I have neither the time nor the patience to reinvent each and every wheel in what I make. There's a question of skill: how many of us could remake some of these mechanisms as efficiently, rigorously, or bereft of side effects (hell, even of bugs) as they currently are?
Ahem, at least if you're not using VC. Scoping problems on for indices, indeed. If you don't know about it, google about it before flaming me, fucktards; it's a known bug with such a history that it's an option in VC.NET that actually comes shipped as default wrong. Borktastic.
So, look, there's more to it still. Sure, writing in assembly is as turing as writing in Scheme and Haskell. But, look, let's play with C++ for a minute. Because C++ has generic programming that works in one fashion for
The fact of the matter is that if turing equivalence mattered, we'd all still be bootstrapping our mainframes with paper clips. And assembly is dead as an application writing language for a damned good reason.
Now go back to writing VB and telling yourself that it's no different than C++. We understand.
- Fatty, King of Contention, Arrogantest Ever (tm)
Re:hehe.. sorta (Score:3, Insightful)
And guess, what, YES, there are problems which are easier to program in C++ than in C#. My job is mostly programming in C# and I'd rather be programming in C++.
There is NO one right programming language or even one right type of programming language.
Re:OOP (Score:4, Insightful)
This is one aspect of Java I appreciated most...
Isn't it obvious? (Score:3, Insightful)
Well, I think the obvious answer is: NONE
I'm sorry, but operator overloading is one of the most gratuitous and depraved features to make it into the language. And it's not just needlessly pretty, but causes all kinds of subtle errors. From not being able to be sure what "a + b" actually does, to disabling the guaranteed evaluation order in boolean expressions.
Re:C++0x is a Frankenstein Java (Score:3, Insightful)
Re:More on D (Score:2, Insightful)
It's time for c++ to move into the 90s and get rid of the preprocessor. It's unnecessary with modern compilers, and it's a pain in the ass.
Why do I have a feeling that you never really used a preprocessor when you do claims like that? Preprocessor is most useful feature, see for example enforcer idiom [cuj.com] by Alexandrescu and Marginean, even if it's just for __LINE__ and __FILE__.
My only complaint for C++ preprocessor is that it's actually C preprocessor, not C++ (performed at the stage before C++ parsing), and is not flexible enough (postponing conditional compilation until macro expansion would be nice).
There should be a rule... Everyone complaining about C++ should know it. Complain about overloading functions, be ready to cite Chapter 13 of ANSI/ISO C++98... It would really reduce S/N.
Re:More on D (Score:1, Insightful)
Damn right, give me an example how you would replace code like this:
#ifdef WIN32
typedef unsigned u32;
#endif
#ifdef MSDOG
typedef unsigned long u32;
#endif
The thing is that the pre-processor can conditionally compile stuff that's not actual code. Especially when writting portable code it's required to conditionally select a header file. You can't replace that with
if( platform ==WIN32 )
typedef unsigned u32;
Re:Anonymous array members (Score:2, Insightful)
It's like everyone and their dog had some pet feature they wanted included in the standard, and the result is a huge mess of stuff that most people won't use but the compiler is forced to support.
You mean like templates, and member function templates, which allow for STL? Or operator overloading and references, which allow for *real* custom types.
Feel free to give specific examples, Mr. Insightful.
Re:C++0x is a Frankenstein Java (Score:1, Insightful)
Troll. Troll. Tr...
Re:Anonymous array members (Score:3, Insightful)
sizeof char is defined to be 1
1 what? 1 char.
A char is NOT DEFINED TO BE A BYTE (8 bits) in the any standard.
Almost always it is, though.
Take a look at the Texas Instruments TMS320C3x family of DSP's. It can do no byte level access. In the c compiler for it, sizeof char is 1 and defines a char as 32 bits. This means sizeof long is 1 and defines 32 bits as well. and this is completely standard compliant!!
And it also breaks tons of code!
--jeff++