> Programming Languages > C++
Various Topics Home | Disclaimer | Report Adult Posts

Various Topics on C++



C++ - "Java's performance far better that optimized C++" in Programming Languages


Old 06-16-2004   #21
..lent.. ..homir..
 
Default Re: Java's performance far better that optimized C++


"Rainer Hausbach" <R.Hausbach@d-offline.de> wrote in message
news:capfgu$od3$1@mail1.sbs.de...
>
> > So there are something that may be do in C++ and not in Java?

>
> writing an OS ( Kernel ) ?


You, C programmers cannot imagine that C is just one of general purpose
programming languages. It is far from the perfect, dealing with "include"s
we get huge problems with scopes and compilation time takes 1000 times
longer than say Pascal. You console oneself that bad structure of C lang and
slow compiler lead to more optimal code. In fact, kernel can be written in
any general purpose language. The is nothing against laws of the Nature.

In fact, I yould agree with origianl poster, there is one thing. OOP
programming (dynamic memory allocation) enforced by garbage collection makes
it hard to build real-time systems due to non-deterministic responce times.


 
Old 06-16-2004   #22
..lent.. ..homir..
 
Default native java


"Rainer Hausbach" <R.Hausbach@d-offline.de> wrote in message
news:capfgu$od3$1@mail1.sbs.de...
>
> > So there are something that may be do in C++ and not in Java?

>
> writing an OS ( Kernel ) ?


What about running java (bytecodes) natively? Haven't heard about it?
http://www.systronix.com/jstamp/reality.htm


 
Old 06-16-2004   #23
..r.. ..rinki.. ..ff.. .. ..e ..¬ƒceâ€..
 
Default Re: Java's performance far better that optimized C++

Gernot Frisch wrote:

> Well, how about:
>
> long a, b, double c;
> memcpy(&c, a, 4); memcpy(&c+4, b, 4);
>
> or:
>
> template <cl*** T> T& min(T &tParam1, T &tParam2) ...
>
> or:
> #ifndef DONT_WANT_THIS
> gagagugu
> #endif


C sintactic sugar!

Every program you can write in C or C++ may be written
in any other-language that can emulate a Turing-machine
(Cobol, Fortran, APL, PL/!, Algol, Ada, Pascal, Java, C#, etc...).

- Dario
 
Old 06-16-2004   #24
..r.. ..rinki.. ..ff.. .. ..e ..¬ƒceâ€..
 
Default Re: Java's performance far better that optimized C++

Rainer Hausbach wrote:
>>>> So there are something that may be do in C++ and not in Java?
>>>
>>> writing an OS ( Kernel ) ?

>>
>> The "Church Thesis"

>
> nope.
>
>> or "Turing-machine-computable" or ...
>> ... means anything to you?

>
> partially (that's the way lots of cpu's work)
>
> so please:
> -verbose


Every program you can write in C or C++ may be written
in any other-language that can emulate a Turing-machine
(Cobol, Fortran, APL, PL/!, Algol, Ada, Pascal, Java, C#, etc...).

- Dario
 
Old 06-16-2004   #25
..lent.. ..homir..
 
Default Re: Java's performance far better that optimized C++

> > So there are something that may be do in C++ and not in Java?
> > Interesting...


> long a, b, double c;
> memcpy(&c, a, 4); memcpy(&c+4, b, 4);


byte[] a = new byte[100];
byte[] b = new byte[100];
System.arraycopy(a, 0, b, 0, 100);


> or:
>
> template <cl*** T> T& min(T &tParam1, T &tParam2) ...

You may wonder but since java 1.5 there is support for generics.




> or:
> #ifndef DONT_WANT_THIS
> gagagugu
> #endif


Remember that java is a multiplatform enviroment thus constructs like these
never bloat your code:
#ifndef cpp_precompiler_sucks_on_Win
aaa
#endif

Use natural constructions like.
If (false) { }
Any good compiler will optimize unused code out. (I know that C
compiler+precompiler) have many things to do besides compilation.



What about such inveronments like Intellij? I don't like idea writing
programs in Visual notepad in 21st century. C++ will never have such one.
C++ will always get problems with includes, slow compilers and unresolved
references. I hate the idea when compiler cannot show me errorous line of
code. IntelliJ checks synthax yet while you're typing, completes reference
to not imported elements.


Remember, a good programmer writes a good program in C++ and Java. Bad
programmer writes bad programs on C+ and Java. Both make faster on
developer-friendly in Java. C++ will never evelove into something friendly
like Delphi/Java langs/environments.


The most important point, JAVA DOES NOT HAVE INCLUDES!!


 
Old 06-16-2004   #26
..m_usen..
 
Default Re: Java's performance far better that optimized C++

On Wed, 16 Jun 2004 19:48:28 +0300, "valentin tihomirov"
<valentin_NOSPAM_NOWORMS@abelectron.com> wrote:

>> > So there are something that may be do in C++ and not in Java?
>> > Interesting...

>
>> long a, b, double c;
>> memcpy(&c, a, 4); memcpy(&c+4, b, 4);

>
> byte[] a = new byte[100];
> byte[] b = new byte[100];
> System.arraycopy(a, 0, b, 0, 100);
>
>
>> or:
>>
>> template <cl*** T> T& min(T &tParam1, T &tParam2) ...

>You may wonder but since java 1.5 there is support for generics.


It's very basic compared to C++ templates.

>What about such inveronments like Intellij? I don't like idea writing
>programs in Visual notepad in 21st century. C++ will never have such one.
>C++ will always get problems with includes, slow compilers and unresolved
>references. I hate the idea when compiler cannot show me errorous line of
>code. IntelliJ checks synthax yet while you're typing, completes reference
>to not imported elements.


I use IntelliJ, and I agree that it would be very hard to produce a
similar IDE for C++. The CDT project in Eclipse is proving this I
think...

>The most important point, JAVA DOES NOT HAVE INCLUDES!!


Modular languages do make writing good IDEs for them much easier. Java
has other problems though, of course, mostly memory usage, start-up
time and performance related.

Tom
--
C++ FAQ: http://www.parashift.com/c++-faq-lite/
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
 
Old 06-16-2004   #27
..rc.. ..licins..
 
Default Re: C++ Intel vs GCC

> I use the GCC 3.4 vs the VS.net 7.1 compiler (which is from intel I
> think) and it gives me you experience in reverse...
> Maybe this is an ethic question?


Some time aho I was inspecting machine code generated by Intel compiler.
Although the compiler did so called "profile based optimizations", it
sometimes failed to apply some some simpler optimizations, like loop
unrolling or use of CPU string instructions. Visual C++ .NET code was
performing significantly faster, although without profile based
optimizations.

Best regards,
Marcin


 
Old 06-16-2004   #28
..ct.. ..zar..
 
Default Re: Java's performance far better that optimized C++

valentin tihomirov wrote:
> "Rainer Hausbach" <R.Hausbach@d-offline.de> wrote in message
> news:capfgu$od3$1@mail1.sbs.de...
>
>>>So there are something that may be do in C++ and not in Java?

>>
>>writing an OS ( Kernel ) ?

>
>
> You, C programmers [...]


We're C++ programmers, please do not confuse the two.
 
Old 06-16-2004   #29
..ct.. ..zar..
 
Default Re: Java's performance far better that optimized C++

valentin tihomirov wrote:
> [...]
> Remember that java is a multiplatform enviroment [...]


That's a very common newbie misconception. Java _is_ a platform.
And constructs like
#ifdef some_platform_or_other
...
don't bloat _my_ code. They bloat the code of the JVM, and the
necessity to run a JVM _always_ bloats the resulting program.

> [...]
> The most important point, JAVA DOES NOT HAVE INCLUDES!!


Another common misconception. What's Java's "import" if not
an include? Oh, wait, if it's not spelled "include", but is
spelled "import", it must be something entirely different... NOT!
 
Old 06-16-2004   #30
..fau.. ....
 
Default Re: Java's performance far better that optimized C++

Gaurav wrote:


Comparisons with other languages are not topical in comp.lang.c++.




Brian Rodenborn
 

Thread Tools
Display Modes





Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0