C++: inherent conflict

W

Web Developer

Hi,

Question: Why is there an inherent conflict between uncompromising
efficiency and portability in C++?


Regards
WD
 
K

Kevin Goodsell

Web said:
Hi,

Question: Why is there an inherent conflict between uncompromising
efficiency and portability in C++?

Homework?

I'm not aware of such a conflict. And the importance of efficiency is
very overstated most of the time. Good design is much more important and
offers more advantages. What good is a fast program if it's buggy, late,
and impossible to maintain? On the other hand, a well-designed program
can be optimized more easily (assuming there's a need - well-designed
software should be very efficient from the start), and can be ported to
faster hardware if needed. Good design gives (nearly) the best of all
worlds. *That* should be your focus, not efficiency.

-Kevin
 
J

John Harrison

Web Developer said:
Hi,

Question: Why is there an inherent conflict between uncompromising
efficiency and portability in C++?


Regards
WD

Whenever you take an uncompromising position you are asking for conflict,
that's life isn't it?

All languages have a conflict between efficiency and portablility, because
programs must run in different environments. They can be made efficient for
one particular environment but only at the cost of being less efficient or
unportable on a different environment.

john
 
T

tom_usenet

Hi,

Question: Why is there an inherent conflict between uncompromising
efficiency and portability in C++?

There isn't. It is easy to write code that is both portable and
efficient in C++.

Tom
 
W

Web Developer

There isn't. It is easy to write code that is both portable and
efficient in C++.

Tom

Unless it's a trick question, which i doubt very much, then your seriously
mistaken.

What do you understand by the term portable? maybe thats your confusion.


WD
 
D

Default User

Web said:
Hi,

Question: Why is there an inherent conflict between uncompromising
efficiency and portability in C++?


That's a nice sweeping statement. What does it mean? Please back it up
with real examples.




Brian Rodenborn
 
V

Victor Bazarov

Web Developer said:
Don't know what it means thats why I asked it.

You're contradicting yourself. You asked "why <something>", thus
implying that you already accepted the existence of <something>,
and are now looking for reasons. Now you're backing out of your
own statement by saying that you don't understand what <something>
means. It's like if I asked "why can crayfish fly?" It is not
possible to answer because it is built on a wrong preposition (that
crayfish can fly). The same with your question. First you show
us what is the "inherent conflict", prove to us it exists, then we
can speculate for the reasons for it to exist. Capisce?
 
N

Niklas Borson

Victor Bazarov said:
There is no question in Tom's two sentences. Unless yours was
a trick question...

It seems fairly obvious that the original question was a homework
assignment in which case there's always the possibility that the
instructor gave a "trick question", i.e., one with a deliberately
false premise.

More likely, though, the instructor actually believes there is
such an inherent confict between efficiency and portability.

The instructor is probably thinking of cross-platform libraries
vs. platform-specific APIs, but this is (1) outside the scope
of standard C++, (2) not an issue for all applications, (3) not
necessarily true even in this more limited context (i.e.,
"high level" != "inefficient"), and (4) probably bad advice for
most programmers (i.e., premature optimization).

My advice to the original poster is this. If you want to please
your instructor, review your notes (or someone else's if you
haven't been attending class -- shame one you!), and parrot
whatever half-truths your instructor has passed off on you.

On the other hand, if you want to actually learn, then don't
just ask for a quick answer. Try to answer it yourself. Look for
gaps in your understanding (e.g., "what does portability mean?")
then read and/or search the internet to find answers. Ask probing
questions of yourself. Read the FAQs for relevant newsgroups.
(Note the plural. Just because you're programming in C++ doesn't
make every question a C++ question.) If you do all that and still
can't figure something out, post a specific question to an
appropriate newsgroup.
 
D

Default User

Web said:
Don't know what it means thats why I asked it.


That is NOT what you asked. You asked why is there an inherent conflict,
not whether there is an inherent conflict. From the other post about not
getting "hello world" to work, I think you should concentrate on
learning the language first rather than philosophical questions. You
have a lot of work ahead of you.




Brian Rodenborn
 
W

Web Developer

Web said:
You're contradicting yourself. You asked "why <something>", thus
implying that you already accepted the existence of <something>,
and are now looking for reasons. Now you're backing out of your
own statement by saying that you don't understand what <something>
means. It's like if I asked "why can crayfish fly?" It is not
possible to answer because it is built on a wrong preposition (that
crayfish can fly). The same with your question. First you show
us what is the "inherent conflict", prove to us it exists, then we
can speculate for the reasons for it to exist. Capisce?

Capisce.

The question was extracted from a book which will remain nameless for the
time being. I don't believe it was intended to be a trick question. Anyway,
I didn't get the concept so I posted it here.

I believe there is an inherent conflict between efficiency and portability
in C++. The primary goal of C++ is to create efficient executable programs.
In order to achieve this, C++ programs must be compiled into machine
language (platform dependant), which is not portable to different
architectures. My answer is similair to the first response I got from my
original post. The rest seem to have misunderstood the nature and meaning of
the question and have gone off on a tangent.


WD
 
E

ES Kim

Web Developer said:
Capisce.

The question was extracted from a book which will remain nameless for the
time being. I don't believe it was intended to be a trick question. Anyway,
I didn't get the concept so I posted it here.

I believe there is an inherent conflict between efficiency and portability
in C++. The primary goal of C++ is to create efficient executable programs.
In order to achieve this, C++ programs must be compiled into machine
language (platform dependant), which is not portable to different
architectures. My answer is similair to the first response I got from my
original post. The rest seem to have misunderstood the nature and meaning of
the question and have gone off on a tangent.

You don't know what it(whatever it is) means, but you believe it
should be something in your imagination? It's just pointless.
You'd better tell what's in your mind clearly instead of asking
for other's opinion on a statement from a mysterious book.
 
W

Web Developer

Capisce.
This isn't what portability means in language terms. C++ is
source-code portable. You can take the same (efficient) source code,
and compile it on and for different machines, from mainframes to
washing machines.

Tom

You are right. This means there is something seriously wrong with this
question (from which I extracted from a c++ book).


WD
 

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

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top