Java's performance far better that optimized C++

V

Victor Bazarov

Julie said:
CFront, the first C++ compiler initially output C code:

http://www.research.att.com/~bs/bs_faq.html#bootstrapping

So what? Many of current compilers output Assembly code. It doesn't
at all mean that all the languages are supersets of respective Assembly
languages. If you hire an interpreter to convert the text contents of
this thread from English to, say, Chinese, would you say that English
is suddenly a superset of Chinese?
 
D

Default User

Julie said:
CFront, the first C++ compiler initially output C code:

http://www.research.att.com/~bs/bs_faq.html#bootstrapping

You don't seem to understand what a language superset is. You could
possibly have a C++ compiler that output C today (maybe anyway, it'd be
pretty archane C). That doesn't mean that the LANGUAGES have a
superset/subset relationship.

It isn't whether C++ can be compiled to C, it's whether all C programs
are valid C++ ones. They aren't and never have been. That's what breaks
the superset relation.

I'm not super-duper versed in the history of C++, but I don't know that
any version of the language that went by that name ever allowed
non-prototyped function declarations.

A decent programmer can convert a C90 program to a C++ one, and make it
syntactically valid fairly easily. There are few semantic issues. With
the advent of the new standard, things have become more complicated on
that front.



Brian Rodenborn
 
J

Julie

Victor said:
So what? Many of current compilers output Assembly code. It doesn't
at all mean that all the languages are supersets of respective Assembly
languages. If you hire an interpreter to convert the text contents of
this thread from English to, say, Chinese, would you say that English
is suddenly a superset of Chinese?

So, what are you saying w/ respect to the thread at hand and the initial
implementation of C++ as a front end?

Do you think that C was *not* a subset of C++ through CFront?
 
M

Mark A. Gibbs

Dietmar said:
Well, I didn't volunteer to specify such a benchmark. I merely outlined how
the benchmark looks like somebody else was talking off. If someone sets up
a benchmark like this and the C++ results show mediocre results, I would
certainly kick and see how to solve the respective problem time efficiently.

heh, no, i wasn't suggesting you do it, no was i implying i would. i
don't have the know-how necessary to do this, nor do i have the time to
spend obtaining it. consider it more a recommendation to the next yoyo
who is planning or performing some pointless and unscientific benchmark
to prove that they're right.
Is this sort of task typical for Java programs? It is not for C++ programs.
In the C++ I'm writing I tend to deal with more complex objects than
integers.

for java programs? i seriously doubt it. i wanted to demonstrate that
the concept could be used for a wide range of tests, cpu or i/o bound,
or both. conceivably, java would perform poorly on tests that tend to be
cpu bound or tests that require a lot of memory shuffling, and better on
i/o bound problems.

i write low-level, high-performance code mostly, so i don't tend to
think in terms of massive oo hierarchies. the test i mentioned above
would probably be of interest to those in encryption.
There is another twist to it: it should also be possible to submit benchmark
specifications, e.g. to highlight specific strength of a certain approach to
the solution. Of course, such an objective measure would take all the fun
out language flame wars...

i doubt that. there would always be some idiot toeing the party line
about java's/vb's/c#'s superiority and that c++ is a dead language. i
think it would be more fun to have an actual dataset to point at while
laughing them out of dodge.

mark
 
J

Julie

Default said:
You don't seem to understand what a language superset is. You could
possibly have a C++ compiler that output C today (maybe anyway, it'd be
pretty archane C). That doesn't mean that the LANGUAGES have a
superset/subset relationship.

It isn't whether C++ can be compiled to C, it's whether all C programs
are valid C++ ones. They aren't and never have been. That's what breaks
the superset relation.

I'm not super-duper versed in the history of C++, but I don't know that
any version of the language that went by that name ever allowed
non-prototyped function declarations.

A decent programmer can convert a C90 program to a C++ one, and make it
syntactically valid fairly easily. There are few semantic issues. With
the advent of the new standard, things have become more complicated on
that front.

Brian Rodenborn

Good point about the prototyping. I see your point now.
 
I

Ioannis Vranos

Dario (drinking coffee in the office…) wrote:


Ok I noticed how long this troll discussion has got, so I decided to
join. :)

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

Please give me your curriculum, so I can hire you in my company!


Is it possible to write a stand alone java virtual machine in java?
However they are written in C++. :) Java is not a systems programming
language.






Regards,

Ioannis Vranos
 
D

Default User

Julie said:
So, what are you saying w/ respect to the thread at hand and the initial
implementation of C++ as a front end?

Do you think that C was *not* a subset of C++ through CFront?

You need to brush up on your set theory. There's a difference between
two sets having an intersection and one set being a subset of another.
Do I have to give you a grade school example, or is that enough for you?




Brian Rodenborn
 
J

Julie

Default said:
You need to brush up on your set theory. There's a difference between
two sets having an intersection and one set being a subset of another.
Do I have to give you a grade school example, or is that enough for you?

Brian Rodenborn

Brian, please take your derogatory remarks elsewhere, they are not welcome
here.

One of the biggest problems w/ this newsgroup is the attitude that some take in
that whatever they say is the end of the discussion, no supportive evidence or
otherwise is necessary. Case in point is this very discussion: 'C++ isn't a
superset of C' -- end. No supportive statements are provided. For a reminder
to all -- this is *NOT* an appropriate way to have a discussion. Perhaps in a
dictatorship or monarchy, such assertions are expected and 'tolerated', but not
here.

With respect to my comments on on CFront, C++, and C, I was (incorrectly)
presuming that since the output of CFront was C, CFront would also accept *any*
C construct as well. As has been pointed out in a separate sub-thread, this is
not the case. I don't have a problem with changing my understanding of this,
and readily accept it and will make the necessary mental notes. Remember, this
is a *DISCUSSION* where ideas are exchanged and the facts presented. It is the
latter that I often see neglected.

I went and did some of my own research on the topic and (re) found the
following article by BS:

http://www.research.att.com/~bs/siblings_short.pdf

This _substantively_ answered a lot of questions for me, and unlike a lot of
blather in this forum, presented the facts in a step-by-step manner in neither
a derogatory or condemning way to those that believed otherwise or had
differing opinions.

Personally, I am no longer interested in considering the set relationship
between C and C++, regardless of some of BS comments regarding the 'set'
relationship between C and C++:

http://www.research.att.com/~bs/bs_faq.html#C-is-subset

I now consider C++ a _child_ of classic C, and a _sibling_ of current C.

-end
 
V

valentin tihomirov

Is it possible to write a stand alone java virtual machine in java?
However they are written in C++. :) Java is not a systems programming
language.

Can you write a stand alone C++ platform in C++? SystemC is system
programming language.
 
V

Victor Bazarov

Julie said:
So, what are you saying w/ respect to the thread at hand and the initial
implementation of C++ as a front end?

Do you think that C was *not* a subset of C++ through CFront?

It doesn't matter what I think or what you think. It matters what was
and what wasn't. C++ has never been and never will be a superset of C
just like English has never been and will never be a superset of Low
German or French has never been and will never be a superset of Latin.

V
 
J

Julie

Victor said:
It doesn't matter what I think or what you think. It matters what was
and what wasn't. C++ has never been and never will be a superset of C
just like English has never been and will never be a superset of Low
German or French has never been and will never be a superset of Latin.

V

I now realize that. However, not because you said so, but because I researched
it. Read my other response in a sub-thread if you care what I've found/think.
 
V

valentin tihomirov

Yes. Windows is written in C++ for example.

You're right.


But Windows executes on a platform not written in C++. C++ is translated
into machine code that is enabled on the target platform. There is always
something underlying that you cannot write in the same lang. The same appies
in Java. Java platform is needed to execute Java. Once got it, you can start
building whatever you want. Java does not need absolute memory access to
control underlying system. It needs API. Should I explain the trick?

SystemC is a high-level system description language. There is no against
rules to have a SystemJ.
 
I

Ioannis Vranos

valentin said:
You're right.


But Windows executes on a platform not written in C++. C++ is translated
into machine code that is enabled on the target platform. There is always
something underlying that you cannot write in the same lang.


Hardly in C++. However if you want to work with assembly inside C++ you
can use asm:


"7.4 The asm declaration

1 An asm declaration has the form

asm-definition:
asm ( string-literal ) ;


The meaning of an asm declaration is implementation defined.

[Note: Typically it is used to pass information through the
implementation to an assembler. ]"



The same appies
in Java. Java platform is needed to execute Java. Once got it, you can start
building whatever you want. Java does not need absolute memory access to
control underlying system. It needs API. Should I explain the trick?



Java has its uses, I do not blame Java for anything so I do not want a
"religious" war. However when we start comparisons, inevitably there
will be such a war. :)


However the design ideals of C++ is to be a compiled language while that
of Java is to be an interpreted language, so their ideals are different.


So their use is dependent on context. If I want to write a native
program in a platform I will use C++, while if I want a web applet I
will use Java. If I want a program run without any recompilation to a
different platform I will use Java, while if I want a program run on a
different platform with maximum space/time efficiency I will use C++.

There are contexts where one can use both.


However what I do not like about Java, and I believe this is the core
problem C++ programmers have with it, is that it is proprietary. If it
wasn't proprietary, I think there would not be much conflict, as there
is not any with C, or Objective C, or Pascal, or Fortran.



I think that Java environment is provocative claiming that it is the
panacea.


If Java was standardised it would be in my plans to learn it.






Regards,

Ioannis Vranos
 
V

valentin tihomirov

Hardly in C++. However if you want to work with assembly inside C++ you
can use asm:
So, there is no need any asm to build an OS. Access to some memory locations
by absolute address (both C/C++ allow that) and handle interrupts, would be
enaught. Many languages targeting specific platforms have
interrupt-processing extentions. The machine instructions (asm) are
generated by compiler.



However the design ideals of C++ is to be a compiled language while that
of Java is to be an interpreted language, so their ideals are different.
So their use is dependent on context. If I want to write a native
program in a platform I will use C++, while if I want a web applet I
will use Java. If I want a program run without any recompilation to a
different platform I will use Java, while if I want a program run on a
different platform with maximum space/time efficiency I will use C++.
Thinking about Java as a lang for applet-writing as narrow-minded.
Performance is not a paramount in our days, development time/effort is.

There are contexts where one can use both.
Good porgrammer writes a good program in Java and C++. Bad programmer writes
a bad program in both. They both accomplish faster in Java.


I think that Java environment is provocative claiming that it is the
panacea.
Any general-purpose language is a panacea.


If Java was standardised it would be in my plans to learn it.
I see that from your statements (you don't know what you're talking about).
Nevertheress, most programmers become C++ programmers exactly because it is
wide sperad lang, i.e. for money. It is not because it is well-organized or
specified.



cheers
 
I

Ioannis Vranos

valentin said:
Good porgrammer writes a good program in Java and C++. Bad programmer writes
a bad program in both. They both accomplish faster in Java.


Fanaticism is not a good advisor. :) Why faster in Java? Can you give a
concrete example?


Any general-purpose language is a panacea.


No it is not. There is not panacea in terms of programming paradigm (for
example you can't replace generic programming with OO paradigm), nor in
terms of programming language (for example you can't replace HTML
neither with Java or C++, another example is PHP), nor in terms of a
system and so on.

The programming world is multi paradigm and multilingual. When you
understand this, it will be good for you.

As I said one can use C++, or Java or whatever else to make regular
Windows applications for example. However your favourite language is
Java and mine C++, and we will continue to use them as far as they do
their job very well. When we will not be able to make something with our
own favourite language we will use something else (e.g. javascript).


However if Java was standardised, but the framework could continue to be
kept proprietary (APIs, virtual machine etc.), many proprietary concerns
of programmers would have been answered and things would be better.

Wouldn't that be great?


The rest of discussion about which language is better, Java, C++,
Delphi(Pascal), Objective C, C# end to nowhere, since anyone prefers his
favourite language.






Regards,

Ioannis Vranos
 
I

Ioannis Vranos

Julie said:
I now consider C++ a _child_ of classic C, and a _sibling_ of current C.


Myself consider C++ as the next step in the evolution process. So at the
beginning there was BCPL, then became B, then became C, and then became C++.






Regards,

Ioannis Vranos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top