Slashdot Mirror


Standard C++ Moves Beyond Vapor

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."

127 of 385 comments (clear)

  1. 10? by sean23007 · · Score: 3, Funny

    This includes the first C++ compiler that fully implements the 1998 ISO/ANSI C++ standard (including "export")

    1998. Ten years, eh? Oh wait- what year is it again?

    --

    Lack of eloquence does not denote lack of intelligence, though they often coincide.
    1. Re:10? by sean23007 · · Score: 2

      ignore that. the guy at the computer next to me read it to me and either i misinterpreted him or he misspoke. damn it.

      --

      Lack of eloquence does not denote lack of intelligence, though they often coincide.
    2. Re:10? by Iamthefallen · · 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!

      --
      Wax-Museum Fire Results In Hundreds Of New Danny DeVito Statues
  2. C+_ by Second_Derivative · · Score: 3, Funny

    We have here to my knowledge the first known /. misspelling of a story TITLE

    Yeah, well done, 'editors' ;)

    - S_D
    Has Karma to blow

  3. linux kernel by Anonymous Coward · · Score: 3, Funny

    "There are rumors they can compile the Linux kernel too"

    Finally!! Someone pulled it off!

  4. GCC is missing stuff? by stonecypher · · Score: 4, Interesting

    If so, where can I go to find out what GCC is missing?

    (I had to write this three times because of that damn 20 second after reply widget. Thanks, trolls.)

    --
    StoneCypher is Full of BS
    1. Re:GCC is missing stuff? by norwoodites · · Score: 5, Informative

      gcc is missing export and some other stuff see http://gcc.gnu.org/bugs.html for more examples of what is missing, scroll down.

    2. Re:GCC is missing stuff? by RealityThreek · · Score: 5, Informative

      Go buy the newest version of Bjarne Strostrup's book, and try out his example programs in the majority of C++ compilers.

      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.

      --
      :wq
    3. Re:GCC is missing stuff? by Sancho · · Score: 3, Insightful

      Is the Linux Kernel written in C++? I thought it was straight C.
      Besides, even if it WAS in C++, most likely it would just use features that the compiler could handle.

    4. Re:GCC is missing stuff? by _|()|\| · · Score: 2
      where can I go to find out what GCC is missing?

      "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. 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, Perennial, and Plum Hall. Compilers include: IBM, Sun, Metrowerks, Intel and KAI, MS, GNU, Borland, and Comeau.

    5. Re:GCC is missing stuff? by Matthew+Austern · · Score: 2, Informative

      Exported templates, universal character names in identifiers, and a few less important things. As of 3.1, gcc has a pretty complete standard library.

    6. Re:GCC is missing stuff? by legis · · Score: 2

      > As of version 3.x GCC is missing the capability to compile Linux kernel.

      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

    7. Re:GCC is missing stuff? by stripes · · Score: 3, 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.

      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).

      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.

      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...

    8. Re:GCC is missing stuff? by stripes · · Score: 2
      Having a sufficiently simple language definition makes having multiple compatible implementations a nonproblem. Consider Python -- it has three implementations (cpython, jython and stackless), and very rarely does one of the alternate implementations support something incorrectly. Scheme (well, R4RS and prior) tends to be consistantly well-implemented as well (granted, most scheme compilers and interpreters have varying extensions and such -- but it's rarer to see outright broken language features in them than in C++).

      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).

  5. You mean usenet by Anonymous Coward · · Score: 2, Insightful

    It's a usenet thread, not a google thread.

    1. Re:You mean usenet by Anonymous Coward · · Score: 4, Funny

      There was a time when it was called usenet. Unless you have been living in a cave you will know that Google bought the usenet and renamed it to google groups.

    2. Re:You mean usenet by Jester99 · · Score: 2
      Blockquoth the poster:

      There was a time when it was called usenet. Unless you have been living in a cave you will know that Google bought the usenet and renamed it to google groups.


      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."
  6. what am I missing? by TheQuantumShift · · Score: 2, Interesting

    So up until now all compilers have been incomplete? What insanely great features have had to be left out because of this? I'm not a developer, so I'm more than a little ignorant. Mainly I'm just wondering if this will allow fewer lines in the same code, shorter compile times, etc...

    --

    Shift happens. Fire it up.
    1. Re:what am I missing? by Anonymous Coward · · Score: 2, Informative

      No, partial specialization has been supported by most compilers EXCEPT for VC++ for quite a while now. That's the biggest gripe that I (and many others) have with the MS compiler. Fix that, and some of the other problems would go away as well (it would be much easier to write a decent implentation of the standard library, for one).

    2. Re:what am I missing? by Josh · · Score: 2, Informative

      The implementation of the 'export' feature for templates has been missing from most compilers. Having it enables projects to possibly compile faster and with less code bloat in the binaries. Using templates often leads to faster executables than other strategies for doing the same thing.

    3. Re:what am I missing? by Josh · · Score: 2, Interesting

      It is less code bloat in the individual object (.o) files. Shouldn't affect a final executable, but it does affect space/compile time on a developer's machine.

  7. GCC code is slow as molasses by October_30th · · Score: 2, 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.

    --
    The owls are not what they seem
    1. Re:GCC code is slow as molasses by Unknown+Lamer · · 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):

      • According to the SPECInt2000 results on an AMD Athlon CPU, the code generated by GCC 3.1 is 6% faster on the average (8.2% faster with profile feedback) compared to GCC 3.0. The code produced by GCC 3.0 is about 2.1% faster compared to 2.95.3. Tests were done using the -O2 -march=athlon command-line options.
      • The compiler now supports MMX, 3DNow!, SSE, and SSE2 instructions. Options -mmmx, -m3dnow, -msse, and -msse2 will enable the respective instruction sets. Intel C++ compatible MMX/3DNow!/SSE intrics are implemented. SSE2 intrics will be added in next major release.
      • Following those improvements, targets for Pentium MMX, K6-2, K6-3, Pentium III, Pentium 4, and Athlon 4 Mobile/XP/MP were added. Refer to the documentation on -march= and -mcpu= options for details.
      • For those targets that support it, -mfpmath=sse will cause the compiler to generate SSE/SSE2 instructions for floating point math instead of x87 instructions. Usually, this will lead to quicker code -- especially on the Pentium 4. Note that only scalar floating point instructions are used and GCC does not exploit SIMD features yet.
      • Prefetch support has been added to the Pentium III, Pentium 4, K6-2, K6-3, and Athlon series.
      • Code generated for floating point to integer converisons has been improved leading to better performance of many 3D applications.
      There is also AltiVec support for the PowerPC now. You can also trying using -fprofile-arcs, run your program once, then recompile with -fbranch-probabilities to help GCC predict branches (but then again if all your code does is crunch large numbers, there might not be too many branches in the first place).
      --

      HAL 7000, fewer features than the HAL 9000, but just as homicidal!
    2. Re:GCC code is slow as molasses by Billly+Gates · · Score: 2

      I believe the alpha version of gcc has had some optimization problems for some time. I remember reading here back in 99 about a %40-50 performance hit for standard c code. This created headaches for alphalinux. If you compilied the code with gcc the kernel would be as slow as mollasis. The problem is that most hackers who write gcc have intel based machines. The rest use a few sparcs and powerpc's from apple since they can compile the code more optimally for their platforms. This is why many risc linux users still avoid using alpha's. I know there was a similiar problem for powerpc linux a couple of years ago until enough programers bought some macs and fixed it.

    3. Re:GCC code is slow as molasses by Unknown+Lamer · · Score: 2

      er... Apple has a beta version of gcc 3.1 with full objective C support AND altivec supprot.

      GCC 3.0.4 also has full Objective-C support. You probably mean Objective-C++. Objective-C++ isn't really its name, but it gets the point across I guess (you can mix C++ and Objective-C code in the same file to gain the strengths of both...e.g. Objective-C's better class system + C++'s overloading support). I think that Apple recently (a few months ago) donated the C++ support to the Objective-C compiler to GNUStep.

      --

      HAL 7000, fewer features than the HAL 9000, but just as homicidal!
    4. Re:GCC code is slow as molasses by Matthew+Austern · · Score: 2, Informative

      Guiding declarations are an obsolete and rather arcane feature that was present in some early versions of pre-standard C++ but that aren't part of the C++ standard. For the most part they're only of historical interest. (Assuming you're interested in the history of such things, that is.)

      If you've got legacy code that used guiding declarations and you need to know how to convert it to standard C++, there's a nice discussion in the kcc documentation.

  8. A REPLACEMENT FOR C++ by egg+troll · · Score: 2, Funny

    Hello Gentlemen,

    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

    --

    C - A language that combines the speed of assembly with the ease of use of assembly.
    1. Re:A replacement for C++ by Anonymous Coward · · Score: 2, Interesting

      Dude! You totally ripped that off from an earlier comment attached to this story!

      Wow, good use of plagarism!

  9. Ahhh by PhoenxHwk · · Score: 2, Funny

    Wow! A compiler! Now all we need is a language whose syntax makes sense! I have an easier time coding in Perl than trying to use the bloody C++ STL.

    1. Re:Ahhh by ZxCv · · Score: 3, Interesting

      .... Now all we need is a language whose syntax makes sense! ....

      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!

      --

      Perl - $Just @when->$you ${thought} s/yn/tax/ &couldn\'t %get $worse;
    2. Re:Ahhh by Cardhore · · Score: 2

      Like scheme?

    3. Re:Ahhh by Peaker · · Score: 2

      Objective C is even worse.
      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.

    4. Re:Ahhh by PhoenxHwk · · Score: 2

      Hey. I'm just making the point that the already-implemented features make C++ a burden to use. C++ is always the last language I would ever choose to do anything in. Last thing, IMHO, that it needs is more crap I'll never be able to use.

    5. Re:Ahhh by pyrrho · · Score: 2

      slow on the uptake I'm only now realizing that C++ is a topic of some fea^H^H^H^H controversy on slashdot.

      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++!

      --

      -pyrrho

    6. Re:Ahhh by Kirruth · · 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.

      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.

      --
      "Well, put a stake in my heart and drag me into sunlight."
    7. Re:Ahhh by cduffy · · Score: 2

      Have you ever written anything in a truly elegant language? Go learn one, and code in it for a while (about half a year will do), and see if you can go back to C++.

    8. Re:Ahhh by cduffy · · Score: 2

      Personally, I consider Scheme and Python both elegant languages -- C and Java are clean, but not quite elegant; C++ is not even clean.

      That said... elegance in this context is not just about beauty (though elegant languages are beautiful) but about simplicity. Simplicity is a very important quality for a language to have -- looking only at power and flexibility without simplicity as a balancing factor leads to languages like Perl where things like regular expressions have their own built-in syntax. Further, simplicity is less of a personal value judgement than you make it to be. Yes, there's something to elegance beyond simplicity -- but simplicity is perhaps at the core of all that is elegant. There is a widely appealing aesthetic element, however, just as much as with Behtoven's music or Dali's paintings. One simplistic test: I can introduce Python to first- and second-year programming students, and in under two minutes they're wowed. That doesn't happen with C++, or even C or Java (and certainly not Pascal or BASIC). Elegance alone isn't useful in the Real World, of course -- but back it with power and one has a truly Good Thing.

      Learning 3 or 4 different languages and being able to pick the one that makes any job easiest (that is, the code simplest and thus most maintainable and extendable) is far, far better than having a hammer and being convinced that any problem you look at happens to be a nail.

  10. Re:Compile the kernel? by BlueFall · · Score: 2, Informative

    The kernel has been pretty much tailored to gcc and many other compilers seem to have trouble with it.

  11. every c++ compiler is different by rebelcool · · Score: 3, Informative
    so far, c++ code hasnt been very portable among different compilers (even different versions of the same compiler... i've got plenty of textbook code around that compiles under the g++ 2.x series, but not g++ 3)

    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..

    --

    -

    1. Re:every c++ compiler is different by randombit · · Score: 4, Informative

      My understanding of C++ is that it doesn't define things like how class data is stored, standard name-mangling, etc.

      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).

    2. Re:every c++ compiler is different by randombit · · Score: 2, Interesting

      compiles under the g++ 2.x series, but not g++ 3)

      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.

    3. Re:every c++ compiler is different by Matthew+Austern · · Score: 2, Informative
      There has also been an IA-64 C++ ABI since the start

      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.

    4. Re:every c++ compiler is different by be-fan · · Score: 2

      Actually, Intel C++ 6.0 and GCC 3.1 (out real soon now) should both support almost all of the ABI. Intel says you can link ICC-compiled stuff to GCC compiled stuff now. It seems to work for some basic code so far, but I haven't tried anything complex yet.

      --
      A deep unwavering belief is a sure sign you're missing something...
  12. C+_ by CptNoSkill · · Score: 2, Funny

    It is good to see the conspiracy of silence finally ended. I have been using this program language since it was started, and finally to see C+_ to get the respect it deserves.I'd say it is the greatest... wait a minute, C++ where the hell did that come from??? Damn, slashdot, covering up the real "C+_" with the fake C++ language,can you say
    C-O-N-spiracy

  13. Not much by Bastian · · Score: 4, Interesting

    Unless a few of the unimplemented language features have uses that nobody has thought of (not entirely unlikely since this is the first compiler I know of that supports all of them), I doubt it will make a huge difference for most coders. C++ programmers have gotten along fine without them thus far.

    However, it is nice to see that they have made it in. Maybe now other groups will start imlementing the full language, too.

  14. From Later in the Thread by Ieshan · · Score: 5, Informative

    "The product Edison sells is basically just the front end. Someone needs
    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?

  15. Sun and Java vs. C++ by sterno · · Score: 3, Interesting

    Sun is constantly talking about protecting the Java language for the sake of humanity. I find it rather amusing, by comparison, that C++ is so out there in the open that it took 5 years to actually get a complete implementation of it. Evidence that such tight controls aren't necessary to make a language stable and long lasting?

    --
    This sig has been temporarily disconnected or is no longer in service
  16. Great. by MadFarmAnimalz · · Score: 2, Funny

    Wonder how long the man page is.

    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.

    --
    Blearf. Blearf, I say.
  17. Re:Their product is only a front end by randombit · · Score: 2

    So while it is worth applauding a product which can handle the entire language, their work is not complete by any means. I sincerely hope they can produce the additional utilities that would make it worth implementing on. It is certainly promising.

    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.

  18. No linux kernel compile, sorry by ZeekWatson · · Score: 2, Informative

    Uh, ze linux kernel isn't written in C++, it is written in C.

    Also, linux (kernel) uses a bunch of (proprietary to GCC :) extensions to C that no other compiler has, so this compiler hasn't a hope in hell of compiling the kernel.

    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.

    1. Re:No linux kernel compile, sorry by joib · · 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.

  19. A replacement for C++ by Anonymous Coward · · Score: 3, Funny

    Hello Gentlemen,

    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.

  20. Missing Features List As Of Last Year by Carnage4Life · · Score: 5, Informative
  21. Re: We need an engineer who knows the whole langua by wray · · Score: 4, Informative

    Frankly, your number pulling of "99% of software engineers" not needing the speed of C++ is just ridiculous and arbitrary. Look at the sheer number of complaints of about gnome, kde, mozilla, and related projects being to slow and you will realize that there is never enough speed. And those are just UI programs.

    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.

    --
    Guess what? I got a fever! And the only prescription.. is more cowbell!
  22. Mozilla C++ Portability Guide by Malc · · Score: 3, Informative

    You should take a look a the Mozilla C++ Portability Guide. It's quite depressing.

    1. Re:Mozilla C++ Portability Guide by Anonymous Coward · · Score: 2, Informative

      yes that IS depressing. Most of the things I do to help me keep bugs down are "dont's" and the things I dont do to keep bugs down are "do's". My favorite out of that list HAS to be #if 0. I never never never never ever use that. Why? Im lazy. It will never get put back in correctly. I would ask a better question when you use #if 0. Why in THE HELL are you checking in code that does not work? You obviously KNOW it doesn't work. Why are you checking it in? Open another file plop the code in there. Take it out of the other file and do not be so sloppy. Had one programmer that did the #if 0 'trick' quite a bit. He left the project (then the company). But we were stuck with LARGE chunks of code we were not quite sure how they hell it even compiled. Im talking 20 pages of commented out stuff. When we found those little gems we were ready to kill. If it doesn't work take it out... Extra junk laying around in a file makes a already tough job even harder!

    2. Re:Mozilla C++ Portability Guide by mce · · Score: 3, Informative

      While I agree that the state of C++ compilers could be a lot better (more power to EDG!), the Mozilla C++ Portability Guide is seriously outdated. It is by now 4 years old, and it shows. The claims about the HP compiler, for instance, apply to the previous compiler. No, not just the previous version, the previous compiler, for which HP has discontinued all support some time ago already. Actually, even back in April 98, HP's CC compiler was already being phased out and replaced by the much much better aCC one. Actually, we made the switch some time (I don't recall exactly) before the start of my current project in September of 1997.

    3. Re:Mozilla C++ Portability Guide by Anonymous+Brave+Guy · · 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.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  23. Info available on EDG's website by xphase · · Score: 4, Informative
    For those who don't trust a google discussion(like me), EDG's website has info here:
    Supported C++ and C Language Features

    This page also says:

    There is also a GNU C compatibility mode, which provides the extensions supported by GCC (version 3.0.1), along with various undocumented features and bugs. The compatibility is good enough that the front end can compile the Linux kernel and utilities. At present, there is no g++ mode, i.e., no way to enable GNU extensions and C++ mode at the same time.

    --xPhase

    --
    The following sentence is TRUE. The previous sentence is FALSE.
  24. Re:Their product is only a front end by Matthew+Austern · · Score: 3, Informative
    In particular, I know that KAI C++ and Compaq's C++ compiler are both based on EGD.

    Yes, KAI and Compaq use the Edison front end. So do Comeau, SGI, Intel, and a number of other compilers. See EDG's site 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 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.

  25. Re:Anyone Can Claim Standards Compliance, Prove It by _|()|\| · · Score: 5, Informative
    On the other hand passing the C/C++ User Journal's compiler roundup's set of conformance tests from Dinkumware, [et al.]

    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.

  26. Re: We need an engineer who knows the whole langua by WolfWithoutAClause · · Score: 2
    Frankly, your number pulling of "99% of software engineers" not needing the speed of C++ is just ridiculous and arbitrary.

    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.

    --

    -WolfWithoutAClause

    "Gravity is only a theory, not a fact!"
  27. Re: We need an engineer who knows the whole langua by WolfWithoutAClause · · Score: 3, Insightful
    Look at the sheer number of complaints of about gnome, kde, mozilla, and related projects being to slow and you will realize that there is never enough speed. And those are just UI programs.

    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.

    --

    -WolfWithoutAClause

    "Gravity is only a theory, not a fact!"
  28. More information: what this really means by Anonymous+Brave+Guy · · 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 do indeed produce C++ front end compiler tools, and it is these that have just been released.

    However, major C++ vendors including Comeau Computing use that in their compilers. Comeau already have a beta of their 4.3.0 compiler available at their on-line compiler. The full version is due later this month.

    Dinkumware 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.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  29. Re: We need an engineer who knows the whole langua by WolfWithoutAClause · · Score: 2
    If you have written a compiler (maybe even if you haven't) you will realize that writing a switch statement involves a jump table. Avoiding jumps really helps speed,

    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.

    --

    -WolfWithoutAClause

    "Gravity is only a theory, not a fact!"
  30. Re: We need an engineer who knows the whole langua by mikeb · · Score: 2, Insightful

    > I'm fed up with my software core dumping, memory leaking ... [etc.]

    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 :)

  31. Re:What is "standard?" by Arandir · · Score: 2

    Doesn't it say something about the language's lack of standardization if you have to read a long technical book in order to understand how to use the tools that let you make your code portable?

    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."

    --
    A Government Is a Body of People, Usually Notably Ungoverned
  32. The Language is Complicated by Greyfox · · Score: 2, Insightful
    Because it lets you do complicated things. Part of the problem is I don't think anyone (including Stroustrup) have any idea of all the complicated things you can do with it. I'd be surprised to find a university course on the topic that even scratches the surface of what is possible with it. A major part of the problem has been what this story's about; no compiler implemented all the language features and the features there were implemented were not implemented correctly.

    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.

    --

    I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

    1. Re:The Language is Complicated by stripes · · Score: 2
      Because it lets you do complicated things. Part of the problem is I don't think anyone (including Stroustrup) have any idea of all the complicated things you can do with it.

      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).

      If you want to see some of the really weird things 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.

      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.

    2. Re:The Language is Complicated by pi_rules · · Score: 3, Insightful

      Part of the problem is I don't think anyone (including Stroustrup) have any idea of all the complicated things you can do with it.

      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.

    3. Re:The Language is Complicated by Bouncings · · Score: 2

      I think you're missing the point. "Doing complex things" is not the gaol of a good language -- "doing complex things simply" is. And those of us who have waded through "powerful" C++ code can all attest to how refreshing it is to see normal structured C code. :)

      --
      -- Ken Kinder ken@_nospam_kenkinder.com http://kenkinder.com/
  33. Re:Using the NULL pointer feature in C++ by be-fan · · Score: 2

    Actually, what deferencing the NULL pointer does depends on the platform. In plain DOS, it reads whatever value is in memory location 0 (part of the interrupt descriptor table on x86), since DOS doesn't use memory protection. In protected memory OSs, deferencing the NULL pointer essentially becomes an access to memory address 0, and this address is always unmapped by the kernel so referencing it generates a fault, which the OS catches, and results in the application being killed. It doesn't warp spacetime or anything like that, if that's what you were hoping for...

    --
    A deep unwavering belief is a sure sign you're missing something...
  34. Re: We need an engineer who knows the whole langua by be-fan · · Score: 2

    Hell, given gnome and kde, developers these days can't write acceptably fast software even in C/C++ (even on my 1.5GHz Athlon XP, KDE 3.x and GNOME 1.4 are pushing the limits of 'acceptable'), so maybe if they switched to languages that would allow them to add stupid features even more quickly without borking performance, software might even get faster! Seriously, though, it's all relative. You use whatever language you're comfortable with. Personally, I don't find C++ all that ardous, and with STL and whatnot, its as easy to write C++ applications as Java apps. When I need to interface at the shell level, however, I tend to use Perl, which can't be beat for its quickness and utility. But if you don't like C++, that's fine. Go use Java or something. I personally won't touch Java with a ten-foot pole, but then again, I grew up with C++. Of course, for some things, C/C++ is unavoidable. Kernel stuff, for example. Even C++ is almost too high-level for kernel development (lots of runtime support needed).

    --
    A deep unwavering belief is a sure sign you're missing something...
  35. It's a pity that the standard is broken. by Ungrounded+Lightning · · Score: 4, Insightful
    Congratulations to the Edison Design Group. An awesome job.

    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?

    --
    Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    1. Re:It's a pity that the standard is broken. by Sax+Maniac · · Score: 2
      Mod this parent up! Right on.

      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.

      For example:

      • Make your constructors private, and only do minimal intitialization (set values to zero, no subobject initialization or sending this off to another).
      • Write a separate initialization function called that can be called to really init the object.
      • Write a public static method that creates the object with the constructor and runs the init routine.
      This causes the entire virtual table to be done before you attempt to call any virtual functions, or hand this off to other objects that might try to call virtual functions before it's done cooking. That sidesteps the problem of compilers screwing it up.

      --
      I can explanate how to administrate your network. You must configurate and segmentate it, so it can computate.
    2. Re:It's a pity that the standard is broken. by Ungrounded+Lightning · · Score: 2

      When a virtual function is called directly or indirectly from a constructor (including from the mem-initializer for a data member) or from a destructor, and the object to which the call applies is the object under construction or destruction, the function called is the one defined in the constructor or destructor's own class or in one of its bases,

      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.

      --
      Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    3. Re:It's a pity that the standard is broken. by Ungrounded+Lightning · · Score: 2
      The std says B::f() is considered only if C::f() does not exists. (== C::f() is alias of B::f())

      I read the snippet you posted to mean that C::C() had the option of calling B::f() or C::f(), and got off on a rap on THAT being broken in my second post. I will be more than happy to stand corrected on that issue. What you describe is what I WANT the standard to say for that case.

      But my real gripe is this:
      class A *aPrtToA;

      class X { X(); ~X() };

      class A { A(); virtual void f(); };
      class B : public A { B(); virtual void f(); };
      class C : public B { X anX; C(); virtual void f(); };

      A::A() { aPtrToA = this; }
      X::X() { aPtrToA->f(); } // C::f() or B::f()?
      X::~X() { aPtrToA->f(); } // C::f() or B::f()?
      I claim the standard should require that when anX is constructed or destructed B::f() is called. As I recall the "final" version of the standard it essentially said "don't do that, the behavior is undefined".

      I don't know what current production compilers do. But when I looked at the stuff current about 10 years ago:
      - Some would do C::f() and B::f()
      - Some would do B::f() and C::f()
      - Some would do C::f() and C::f()
      - None would do B::f() and B::f() (IMO the "correct" thing to do).
      --
      Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
  36. Re: We need an engineer who knows the whole langua by be-fan · · Score: 2

    Actually, with a good implementation of the STL (SGI's for example), fast, standard, easy-to-use data structures and algorithms become a prime selling point for C++.

    --
    A deep unwavering belief is a sure sign you're missing something...
  37. Re: We need an engineer who knows the whole langua by be-fan · · Score: 2

    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.
    >>>>
    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.

    --
    A deep unwavering belief is a sure sign you're missing something...
  38. Re:What is "standard?" by be-fan · · Score: 2

    Slashdot drops the symbol when posting as HTML ;)

    --
    A deep unwavering belief is a sure sign you're missing something...
  39. Re: We need an engineer who knows the whole langua by elflord · · 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,

    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.

  40. This is not how GPL works by MrByte420 · · Score: 2, Informative

    >harsh restrictions of the BSD license. It also lacks >the GPLs requirement that anything coded with its >tools becomes property of the FSF. You have this totally backwards. The GPL only says that if you modify the source code of a GPL program amd redistribute it - you must make the orginal code available to the end user. What you use a GPL'd piece of software for is up to you. Furthermore GPL'd software is NOT property of FSF unless you decide to give them those rights. otherwise the copyright is held by the orginal author.

    --
    If religous zealots don't believe in Evolution, then why are they so worried about bird flu?
  41. So can this compiler finally handle THIS... by Lethyos · · Score: 2

    I cannot even begin to count how many times I have wanted to do something along these lines. Keeping everything nice and separated. Instead, the only way to make this work is to include Foo.cpp in main.cpp, which is well, retarded. C++ needs some serious work with templates... so is something like this fixed? Or does it contain some abiguity that I am not aware of?

    /* 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) { /* Do magic here. */ }
    template<class T>
    void Foo<T>::doSomething(void) { /* Do magic here. */ }

    /* main.cpp */
    #include"Foo.h"
    int main(int argc, char *argv[]) {
    Foo<int> *foo;
    foo=new Foo<int>();
    foo->doSomething();
    }

    --
    Why bother.
  42. Re: We need an engineer who knows the whole langua by WolfWithoutAClause · · Score: 2

    There is an argument that drivers would drive much more safely if there was a sharp point sticking out of the steering wheel. Any accident and you would die. The drivers will be really attentive. However to ensure the safety, the drivers are going to have to slow down... In the software world this transfers to less code written.

    --

    -WolfWithoutAClause

    "Gravity is only a theory, not a fact!"
  43. EDG's role by Animats · · Score: 4, Informative
    As others have mentioned, Edison only does the front end. The output is an intermediate form, not object code. There aren't very many C++ parsers. GCC has one, Microsoft has one, and most of the other compilers use the EDG front end.

    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.

    1. Re:EDG's role by pdh11 · · Score: 2, Interesting
      I can't remember which language syntantical structure is responsible, but you can't write an LALR parser for C without resorting to a bit of trickery.

      foo = (bar)-7;

      You can't tell if that's a cast of a negative integer to type "bar" or a subtraction of 7 from variable "bar" unless you know whether "bar" is a typedef name or not.

      But C++ has significantly worse parsing problems.

      Peter

  44. Re: We need an engineer who knows the whole langua by WolfWithoutAClause · · 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.

    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.

    --

    -WolfWithoutAClause

    "Gravity is only a theory, not a fact!"
  45. Do you need VB to troll? by theolein · · Score: 2

    I can't belive posts like this one where an MS troll actually thinks that someone is going to believe things like "GCC is obscured from us by the marketing people at the FSF" or "Java's source seems to be under the monopolistic thumb of Sun" and "Microsoft's "shared source" under which Visual Basic is released definately seems to be the most fair and reasonable of all the licenses in existance" and "harsh restrictions of the BSD license".

    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.

  46. ObjC by theolein · · Score: 3, Interesting

    I am not in any way a C++ programmer. The only thing I've ever read my way through is the Bruce Eckel's book. That was enough for me. I know some Java and C and was starting to learn how to go further on Mac OSX (which uses GCC) and was wondering whether to go with C++ or ObjC. One little trial programme in both and I went with ObjC. It *is* a lot easier, especially if you know some Java and has similar dynamic features. I don't know enough to comment on whther C++ is faster or not but it defintely has a very difficult syntax for beginners.

    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.

  47. Re: We need an engineer who knows the whole langua by elflord · · 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.

    >>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.

  48. Re: We need an engineer who knows the whole langua by WolfWithoutAClause · · 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.

    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.

    --

    -WolfWithoutAClause

    "Gravity is only a theory, not a fact!"
  49. Re: We need an engineer who knows the whole langua by WolfWithoutAClause · · Score: 2
    one gets the impression that you were never using C++ in the first place (compiling C with a C++ compiler doesn't count).

    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...

    --

    -WolfWithoutAClause

    "Gravity is only a theory, not a fact!"
  50. Baby's birthday by Graymalkin · · Score: 2

    June's DDJ (#337) has a pretty good article in it about C++ conformance and actually goes on to test a series of compilers for standards compliance. Pick up the magazine and read the article which was pretty interesting because they used Python to write a test framework that could be used with different compilers and different operating systems. They tested compilers on Solaris, Linux, and Windows2000. GCC 3.04 ended up with the highest passing percentage while VC++ ended up with the worst. They didn't include either the DDJ compiler or Intel's which was one I was especially curious about considering I just got a demo of it.

    --
    I'm a loner Dottie, a Rebel.
    1. Re:Baby's birthday by JKR · · Score: 2, Interesting
      GCC 3.04 ended up with the highest passing percentage while VC++ ended up with the worst.

      Care to elaborate which VERSION of VC++ they tested? I don't get DDJ, and if they're still banging on VC6 that's not very interesting. If MS haven't fixed the conformance problems in VC++.NET it'd be handy to know.

  51. Re:Stop Blaming MS Software Bugs! by GMontag451 · · Score: 2

    There is nothing in your comment that has anything to do with Godel's Theorem.

  52. Re:Actually C++ is MORE efficient that C by himi · · Score: 2

    Using C++ funky bits makes it much harder to control exactly what code the compiler produces, regardless of whether it's more efficient or not. You also need a runtime library for a lot of things. Those are the two main reasons C++ /isn't/ used.

    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 /everything/, and when the compiler you're targetting is as portable as gcc, it's not even that big an isue for portability.

    Kernel coding is /not/ like userspace coding. The code tends to look much the same, but you operate under constraints that make the details vastly different, and which make things like C++ difficult propositions.

    himi

    --

    My very own DeCSS mirror.
  53. Yawn! by McDoobie · · Score: 3, Interesting

    Ada95 has had fully compliant compilers(plural) since at least 1995.(When it was Internationally standardized.)

    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.

  54. Re: We need an engineer who knows the whole langua by adamsc · · Score: 2

    It really gets down to time management: would those programmers take the time saved by using a less-primitive language and use it to fix the design problems behind those slow programs or add a bunch of pointless crap?

    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".

  55. Re:What is "standard?" by be-fan · · Score: 2

    sigh... Maybe I was too subtle?

    --
    A deep unwavering belief is a sure sign you're missing something...
  56. The Google Thread by Taco+Cowboy · · 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=52f2 f9cd.0205100428.7eecbcb6%40posting.google.com&rnum =1&prev=/groups%3Fas_epq%3Dfirst%2520fully%2520%25 20iso/ansi%2520compliant%26num%3D100%26hl%3Den

    instead of

    http://groups.google.com/groups?hl=en&th=e653fbdb7 85c5339&rnum=1

    So what has I done wrong ?

    --
    Muchas Gracias, Señor Edward Snowden !
  57. Re: We need an engineer who knows the whole langua by WolfWithoutAClause · · Score: 2
    Yet, you didn't use STL, and were constantly forced to use unsafe pointer manipulations ?

    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?

    --

    -WolfWithoutAClause

    "Gravity is only a theory, not a fact!"
  58. Re: We need an engineer who knows the whole langua by WolfWithoutAClause · · Score: 2
    In that form, it is indeed a very weak and equivocal statement indeed, but judging by your snippage of my response, it's one that you're having a hard time supporting.

    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.

    --

    -WolfWithoutAClause

    "Gravity is only a theory, not a fact!"
  59. Re: We need an engineer who knows the whole langua by cduffy · · Score: 2

    If it's cheaper to buy a new server or ten than to write the program in a lower-level language and have twice the debugging time and greater risk of security concerns due to buffer overflows and such, then writing the code in a high-level language is the Right Thing to do. If you're writing something that needs every bit of speed available, and the hardware that would be needed to get the same performance in a higher-level language costs more than would be saved by the difference in your time... okay, have fun with your low-level language. Usually when I find myself in a situation like that, I know it's time to raise my rates.

    That said -- a good civil engineer's techniques involve restrictions at their core. Every set of "well, we can do this..." incorporates hundreds of "but never do this, or that; and be sure that this load never exceeds that; and check for so-and-so". A good civil engineer's techniques are indeed self-limiting -- because only by playing within carefully defined limits can one be certain about the safety of the resulting structure. One of the things I agree with regarding software engineering is that far more dicipline is required in the field. Some of this has to be human dicipline -- there's no way around it -- but having tools that make it harder to make mistakes is a Good Thing too. Imagine trying to build chips without design checkers because the EEs should do all that work themselves -- it'd never fly at Intel.

  60. Re: We need an engineer who knows the whole langua by elflord · · Score: 2
    You show no signs of being experienced enough with C++ and other languages to begin to appreciate it;

    Arrogance is not victory (-;

    Oh, ok, one more unbelieveably trivial example. Consider 'int'. What size is it? Yeah I know, its undefined 'for performance reasons'. WTF?

    No, it's undefined because it's undefined in C. Compatibility with C is a big design tradeoff-- and it's largely responsible for most of the sharp edges in C++, but it's also the main reason that C++ has enjoyed such widespread adoption.

  61. Re: We need an engineer who knows the whole langua by elflord · · Score: 2
    Where did I say that?

    Read up a few posts...

    ...code much of it in C++, and without the benefit of the STL.

    Re bounds checking, and unsafe pointer manipulations, these were among your citations of "dangerous defaults".

    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.

    A switch statement can usually be replaced by a table lookup or polymorphism. As you rightly point out, sometimes switch statements are useful-- another good reason to keep them in the language, huh ? (-;

    Using polymorphism for that impacts both readability and speed,

    Sometimes a table lookup is more appropriate than polymorphism, it's a little less opaque. A switch is essentially a sort of inlined table dispatch, so the only reason I see for using it is performance or convenience.

    What colour is the sky in your world?

  62. Re: We need an engineer who knows the whole langua by elflord · · Score: 2
    If it's cheaper to buy a new server or ten than to write the program in a lower-level language and have twice the debugging time and greater risk of security concerns due to buffer overflows and such, then writing the code in a high-level language is the Right Thing to do.

    First, you're assuming that buffer overruns are the only possible error. This is simply wrong. Programs that do not have the benefit of static checking are prone to all sorts of wierd bugs, which ultimately can become security flaws. Apart from anything else, the assumption that C++ code always results in buffer overruns is just bogus. It's very hard to end up with buffer overruns if you stick to safe STL containers.

    That said -- a good civil engineer's techniques involve restrictions at their core. Every set of "well, we can do this..." incorporates hundreds of "but never do this, or that; and be sure that this load never exceeds that; and check for so-and-so".

    Yep. A professionals tools require some discipline to use.

  63. Re: We need an engineer who knows the whole langua by cduffy · · Score: 2

    First, you're assuming that buffer overruns are the only possible error.

    Of course not. I didn't even say safe languages would fix even most security issues, only that the failure to use one would result in a "greater" risk of security concerns. Stop putting words in my mouth. I agree that static checking is extremely important. I do not see how use of STL containers are likely to be useful in fighting buffer overflow vulnerabilities -- most of the vulnerabilities I've seen have been inside boundary code (network or file I/O, parsing routines, &c) where the internal data storage mechanisms used after processing aren't particularly relevant.

    A professional's tools require some dicipline to use.

    Absolutely! But this dicipline is not strictly on the part of the user. When I buy a hammer, I don't expect to have a 3-part procedure I have to follow to prevent the head from flying off -- the tool should just Do The Right Thing, even if it means I don't get the benefits of a detachable hammer head usable as a counterweight. That is to say, the hammer should follow the Principle of Least Surprise. A good programming language should do the same.

  64. Re: We need an engineer who knows the whole langua by WolfWithoutAClause · · Score: 2
    No, it's undefined because it's undefined in C.

    So defining it for C++ would have made it incompatible? On reflection: No, I don't see that.

    But that wasn't the point. My point was that many, many features of the language are unnecessarily dangerous; even an int; you haven't really grokked this point.

    --

    -WolfWithoutAClause

    "Gravity is only a theory, not a fact!"
  65. Re: We need an engineer who knows the whole langua by WolfWithoutAClause · · Score: 2
    Where did I say that?

    Read up a few posts...

    I never said that anywhere.

    As you rightly point out, sometimes switch statements are useful-- another good reason to keep them in the language, huh ? (-;

    Of course, I love switch statements, but the syntax is much more dangerous than it needs to be. If fact you don't actually need 'if' statements, just use switch ;-)

    --

    -WolfWithoutAClause

    "Gravity is only a theory, not a fact!"
  66. Re: We need an engineer who knows the whole langua by elflord · · Score: 2
    Stop putting words in my mouth.

    Oops ... I misunderstood you.

    I do not see how use of STL containers are likely to be useful in fighting buffer overflow vulnerabilities -- most of the vulnerabilities I've seen have been inside boundary code (network or file I/O, parsing routines, &c) where the internal data storage mechanisms used after processing aren't particularly relevant.

    In all of these cases, simply having containers that grow on demand deals with some of the issues, bounds checked access and using STL algorithms instead of loops deals with others. Basically, if you enumerate the things that can go wrong with respect to buffer overruns, I can enumerate a list of reasons why the STL containers address this.

  67. Re: We need an engineer who knows the whole langua by elflord · · Score: 2
    the tool should just Do The Right Thing, even if it means I don't get the benefits of a detachable hammer head usable as a counterweight. That is to say, the hammer should follow the Principle of Least Surprise. A good programming language should do the same.

    Doh! I forgot to respond to this. There are a lot of things a good programming language "should" do, and suffice it to say, no programming language does all of them. This is where tradeoffs come in. Unlike most other programming languages, there is a well reasoned exlpanation (in book form) explaining how and why C++ is designed the way it is, and what the rationale behind the tradeoffs is.

  68. Re: We need an engineer who knows the whole langua by elflord · · Score: 2
    So defining it for C++ would have made it incompatible? On reflection: No, I don't see that.

    For all practical intents and purposes, it would. Consider the implications of trying to reuse C libraries that declare functions that take arguments of type int, or data structures that aggregate ints.

    My point was that many, many features of the language are unnecessarily dangerous; even an int; you haven't really grokked this point.

    Most of the "dangerous" features of the language are a direct result of C compatibility. Compatibility has a lot of disadvantages, but it is dishonest to hype the disadvantages while belittling or ignoring the advantages.

  69. reading too much slashdot by GCP · · Score: 2

    It sucks that all these great technologies are being relegated to obscurity because of ...

    I was trying to figure out how to end that sentence, and all I could come up with was Microsoft and FUD. I've been reading too much Slashdot!


    Yes, you have. While it's true that MS can often save a language from obscurity (BASIC), it's hardly the only way, and making languages popular isn't MS's responsibility.

    Languages like Java, JavaScript, and Perl are extremely popular, yet they owe little to MS. MS pushed for J++, JScript, and ignored Perl almost entirely until very recently, but that didn't matter much.

    What it takes for a language to become popular is some huge advantage -- being the best way to do something that suddenly booms in importance (Perl for CGI) or having billions of dollars of development put behind it (Java, which was also in the right place at the right time), or being an incremental successor that keeps adding goodies to the most popular language (C++ absorbing C developers) so other (better) languages can't easily lure them away.

    A language having some nice features is ... nice, but that's not enough.

    I agree with your frustration, though. I really wish that it could be possible for each of us to create his dream language and just use it wherever we go. Create a way for that to happen, and you'll have real popularity.

    --
    "Those who have never entered upon scientific pursuits know not a tithe of the poetry by which they are surrounded."
  70. Re: We need an engineer who knows the whole langua by cduffy · · Score: 2

    In all of these cases, simply having containers that grow on demand deals with some of the issues, bounds checked access and using STL algorithms instead of loops deals with others. Basically, if you enumerate the things that can go wrong with respect to buffer overruns, I can enumerate a list of reasons why the STL containers address this.

    Then why do we still have buffer overruns, even in C++ code?

    Even accepting your premise that Doing The Right Thing in C++ avoids buffer overflows completely, Doing The Right Thing in C++ is hard, or at least nonobvious -- as evidenced by the beginners (and experienced programmers who lack familiarity with C++) who do the wrong thing.

    Should it be the programmer's duty to be sure they're doing the right thing? Of course! Is that any excuse for using tools that make it easy to do the wrong thing? Unless those tools have some other compelling advantage, absolutely not.

    So... show me the advantage!

    And lest you mention the flexibility involved in being able to do things either the C way or the C++ way or many hybrid ways between, I consider that a disadvantage, and a severe one at that -- redundancy in language design is a Very Bad Thing, as it means the language is not yet elegant; there's still more left to take away. A considered and defendable design decision? Certainly! The correct decision? No.

  71. Re: We need an engineer who knows the whole langua by WolfWithoutAClause · · Score: 2
    For all practical intents and purposes, it would. Consider the implications of trying to reuse C libraries that declare functions that take arguments of type int, or data structures that aggregate ints.

    Hey- you're actually right for once!

    --

    -WolfWithoutAClause

    "Gravity is only a theory, not a fact!"
  72. The C++ standards effort by Per+Abrahamsen · · Score: 2

    As far as I can see, almost all the effort towards a new C++ standard is on the the library side. C++ has an excellent container library (STL), an ok library for serial i/o (iostream), but lacks libraries for networking, threads, file system, etc.

    A bit of language cleanup is done, like getting rid of implicit int. However the major problem with regard to context sensitivity, the declaration syntax, is inherited from C and would be hard to remove.

  73. Re: We need an engineer who knows the whole langua by elflord · · Score: 2
    the only way to tell is by considering whether those tradeoffs are appropriate given the project in mind.

    I'd have to agree with this.

    That said, I run into more projects (far more projects!) for which Java or Python or Scheme is appropriate than C++; at least in my line of work, performance is rarely at a premium

    If you're saying these are "safe" languages, I'd have to beg to differ. Java has some static type safety, but unfortunately, the lack of generics (templates) greatly weakens this. Python is a very nice language, and the tradeoffs it makes are very sensible (in particular, it consistently prefers readability to writability). However, it doesn't make a whole lot of sense to compare it to C++. In my experience, Python does not compete with C++, it compliments it. That is, I use both C++ and python in the same project. As far as being "safe" is concerned, Python has no compile time type safety. It is well designed, and very useful, but I wouldn'y call it "safe".

  74. Re: We need an engineer who knows the whole langua by elflord · · Score: 2
    Then why do we still have buffer overruns, even in C++ code?

    Examples ? I never have buffer runs in my C++ code, so as far as choice of language for me is concerned, this is a non-issue. I suspect most such code probably predates STL.

    Doing The Right Thing in C++ is hard, or at least nonobvious -- as evidenced by the beginners (and experienced programmers who lack familiarity with C++) who do the wrong thing.

    No, it's not "hard" at all. There are beginners books, like Accelerated C++ that teach you to write code in a style that will prevent buffer overruns occurring.

    Of course! Is that any excuse for using tools that make it easy to do the wrong thing? Unless those tools have some other compelling advantage, absolutely not.

    C compatibility is a compelling advantage. It is the main reason that C++ enjoys its current level of popularity. As for "easy to do the wrong thing" ... I think you'd be hard pressed to find a language that doesn't make it easy to do the wrong thing in some form or other. For example, C++ is one of the few popular programming languages with sufficient type safety to prevent the programmer making type errors. Java, and interpreted languages all require a lot of runtime type checking (in Javas case, it's because the language lacks generics and uses a single rooted heirarchy instead)

    I consider that a disadvantage, and a severe one at that -- redundancy in language design is a Very Bad Thing, as it means the language is not yet elegant;

    Elegance is not one of the design goals of the C++ language. Largely because there is very little correlation between elegance (or purity or beauty) and usefulness in real-world projects.

  75. Re: We need an engineer who knows the whole langua by elflord · · Score: 2
    A language can be useful without being elegant -- but an elegant language will be more readable, more easily learned, more maintainable, and more fun to write in.

    All other things being equal, yes, of course. But in the real world, all other things aren't equal. The other languages have poor type safety, and in some cases, a lack of encapsulation. These factors also impact r maintainability (especially encapsulation!) But the more severe impact of not having type safety or encapsulation is that it severely hurts scalability, which is why C++ is still a popular choice for large projects.

    you can make something with a messy design work, but the clean design is the one that'll actually be able to keep up with your requirements over 10 years of part-timer skeleton-crew maintenance.

    That's why you want things like encapsulation and static checking. Clean design isn't that easy when every type of object looks like every other type, and there is no encapsulation.

  76. Re: We need an engineer who knows the whole langua by elflord · · Score: 2
    As for the lack of templates, I just haven't found it to be a problem -- interfaces have served my purposes suitably there.

    How do you write typesafe container classes without generics ? In the case of java, you don't -- you abuse the single-rooted object heirarchy instead. Java containers are no more typesafe than perl or python containers.

  77. Re: We need an engineer who knows the whole langua by cduffy · · Score: 2

    I wouldn't say "no more typesafe" -- at least in Java you'll always get runtime errors for casting that which you get out of your container into the wrong type. Thus, if your compilation process includes a "make test" or some equivalent, such errors will always be caught. In Perl or Python you're not even guaranteed those (unless you try some use of the object which isn't available in the mistakenly-passed type).

  78. Re: We need an engineer who knows the whole langua by elflord · · Score: 2
    I wouldn't say "no more typesafe" -- at least in Java you'll always get runtime errors for casting that which you get out of your container into the wrong type.

    Point taken-- this is a subtle but important distinction. The situation is still quite bad though, because the cause and effect of the error are separated by a wide margin -- that is, you could put an object of the wrong type into a container, and the problem wouldn't surface until you tried to access that element, which means that a simple backtrace (which java is kind enough to give you by default ... )

    All that said, I actually like java. Sort of like C++ without the nasty C-isms. The only thing preventing me from using it is performance issues. But I'd still like to see generics.

  79. Re: We need an engineer who knows the whole langua by elflord · · Score: 2
    One doesn't even need any language support to do encapsulation -- one can do encapsulation in C, or assembly for that matter; it's a matter of good design, rather than language features.

    A language can either facilitate encapsulation, or make it difficult. The whole argument against C++ in this thread has been that it's not idiot proof enough. So in this context, the fact that it may be possible to implement encapsulation via clever hacks is beside the point.

    That said, there's still language support for encapsulation in all those languages I mention.

    Python does not have any access protection on class members. Sure, you can write stub classes, but that requires more design, which eats away at this alleged "rapid development" advantage you're supposed to get from interpreted languages. And it doesn't alter the fact that you don't have private data. Java on the other hand has good data protection, arguably better than C++. Good C programmers can and do encapsulate, but then, good C++ programmers avoid the misfeatures of the language. C++ provides well-defined semantics for encapsulation.

    If this were such a problem as you make it to be, one could (easily!) build a container class in Java that checks the types of objects put into it at runtime against a type passed in on its instanciation. (Heck, if it were a real-world problem, one would expect that Sun would have done it by now). Why don't I do it?

    Because solving this problem in the general sense is roughly equivalent to writing generic containers. It's not easy to come up with a general solution, and writing once-off hacks is painful after a while. So the result is that you have a culture of subverting type-safety.

    Making up objections because they seem like they'd be problems to you, however, makes you no better than those who c

    ... blah blah blah. You miss the point. I'm not canning these things. Java and Python have a lot of good points. So does C++. C++ has a lot of advantages over java and python. Java and Python have a lot of advantages over C++.

    and presuming you have an automatic test suite running after every compile -- which everyone should, no matter the language

    If you want to talk about what everyone "should" do, they "should" use C++ correctly, by avoiding the dangerous features of the language (-; The language "should" avoid putting requirements on the user, such as developing test suites just to make sure the program is type safe. Of course test suites are good, but they are not a replacement for static checking. This is not an either-or proposition-- a test suite and static checking is more reliable than a test suite alone. Moreover, you get static checking for free in C++, and you can do other things besides checking type safety with your test suites. The other problem with test suites is that when you develop a library, your test suite can't check client code-- so you're requiring your clients to develop test suites as well.

  80. Re: We need an engineer who knows the whole langua by elflord · · Score: 2
    If you've got a test suite that runs on every compile, of course, this is less of a problem --

    A lot of problems go away if you test properly, or adopt a number of other sensible practices. Most of the arguments against C++ boil down to what happens when an idiot uses it. The bottom line is that no tool is going to allow idiots to develop large scale applications.

    Regarding speed, btw -- depends on what you're writing, of course, but have you tried particularly new Java runtimes? I've been doing servlets lately, and have been very pleasently surprised by the performance.

    If I were writing internet applications, I'd consider Java. As it is, I'm writing numerical analysis code, and that rules out java. Apart from anything else, bounds-checked element access is a performance killer in itself.

  81. Re: We need an engineer who knows the whole langua by elflord · · Score: 2
    Might I add, however, that Python *does* have private variables, however little-used they may be.

    I've tried using these. Unfortunately, they don't work properly with inheritance.

    Not hard at all. Take an extra parameter on container instanciation that refers to the class name. Every time an Object is passed in, verify that it's a member of that class. Easy. Done.

    Perhaps I'm not understanding ... it looks like you're just doing an up-front runtime type check. I suppose you've at least reduced the problem to something that could be detected with a backtrace.

    You make that sound far worse than it is.

    I don't mean to imply that it's the same thing as a reinterpret_cast -- it's comparable to a dynamic_cast (which is still pretty hideous to a C++ programmer.) Apart from the safety issues, it's also a substantial performance liability. (at least, my experience is that dynamic_cast is very expensive in C++.)

  82. Very outdated by devphil · · Score: 2


    No wonder the roundup showed crappy results. They used GCC 2.95.2, which is three years old and uses a library that's even older.

    GCC 3.x uses a rewritten library. I suspect their "library conformance" ratings would be quite different if they'd tested a compiler that's actually supported.

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
  83. Re:What? by sydb · · Score: 2

    Not only are you offtopic, but you are OUT OF DATE!

    I had karma to burn, so I thought I'd use it getting the karma-free InSaNiAk with his l337 name and zero-content posts modded down. Despite my complaints, I was happy with the results, lame or otherwise ;)

    --
    Yours Sincerely, Michael.