Re: Java or C++?




<adaworks@xxxxxxxxxxxxx> wrote in message
news:yNl5f.17428$6e1.2854@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> "Alan Balmer" <albalmer@xxxxxxx> wrote in message
> news:4qgal1pfc024fset0k61vv0tkp8nr9hrbl@xxxxxxxxxx
> >
> > C++ doesn't force anyone to write unsafe code, and silly analogies
> > don't change that.
> >
> True. C++ does not force anyone to write unsafe code. It does, however,
> make it so much easier to do so. If you are a practicing C++ programmer,
> you realize how easy it is to make errors that are never detected by the
> compiler.

"much easier"? Which language are you comparing C++ to now? C, Java, or
something else?

I find C++ compilers much more helpful than C compilers when it comes to
finding bugs. I migrated from C to C++ four years ago, and it is my
experience that the compiler catches many *more* errors that previously used
to be found at runtime. Many of these errors are silly, like type errors and
uninitialized variables, but I no longer have to track down hard-to-find
runtime bugs on that account, because the compiler finds them for me.

Of course, that may not be due to the change C -> C++, but could be instead
a general improvement in the number of warnings/errors that the compiler
checks for.

However, the possibility of using std::map to express associations between
two related concepts makes it easier and quicker to get a program working
than it used to when I only had C. Having to hand-code such relations in C
invariably leads to bugs at run-time.

> We are talking here about errors that would be detected early
> by a more robust language.

Could you be more specific, please. What errors, what language?

Would you say Java is more robust than C++?

Any language that does not explicitly support the concept of pointers and
(especially) pointer arithmetic would be (much) more robust than C/C++.

-Michael.

P.S. Why are we having this discussion? C++ is a powerful language, and with
all power-tools, some caution is required.


.



Relevant Pages

  • Re: "STL from the Ground Up"
    ... high-level intermediate language than can interoperate with many other ... If your language lacks expressive features then you cannot write code ... memory management in comparison. ... Mostly because type errors mean that the programmer and compiler disagree ...
    (comp.programming)
  • Re: A note on computing thugs and coding bums
    ... It would handle international characters if the execution character ... method I used in "Build Your Own .Net Language and Compiler". ... work areas and counting on Nul is an illusion. ...
    (comp.programming)
  • Re: access(FULLPATH, xxx);
    ... with "trial& error" to just silence the compiler. ... void *foo); ... given that the language in the specification _was_ abiguous and both ... documentation was paramount. ...
    (freebsd-questions)
  • Writing a Roguelike in D, C# and C++
    ... Since I have seen some interest on this newsgroup about which language ... The official compiler is dmd. ... The roguelike I am writing uses variable sized glyphs. ... trigger Hejlberg's garbage collector. ...
    (rec.games.roguelike.development)
  • Re: WaitForSingleObject() will not deadlock
    ... represent an incorrect implementation of the language. ... the *compiler* does not guarantee this. ... but to state it in terms of the execution instead of the formal semantics of the language ... as long as the optimizations do not change the semantics of the language). ...
    (microsoft.public.vc.mfc)