Is that a new netiquette to answer a message in *6* posts? Please try
to do that in one post, easier for everybody.
There is nothing to "manage" when you allocate on the stack.
Of course there is, but the C++ runtime system takes care of it.
Memory management refers to how you deal with the heap containing
objects.
That is the meaning you want to give to it. I take `memory
management` to mean.. well.. memory management.
Pascal, C++ and Java all handle local variable the same way.
For Pascal, I don't know. For Java and C++, I agree, as long as you
consider references to be 'variables'.
C++ is
unusual in that you can allocate objects on the stack, not just
references to them.
Unusual??
If you want to know what int means you have to consult the docs for
the particular platform implementation.
Yes, but you said
C++ types are defined in a platform-dependent way.
C++ types are *not* defined at all, except for the relations between
them and that a char is 1 byte, but I agree we are playing with words.
I think we understand each other here.
Please, try to stay as polite as possible.
Java fixes the sizes. C++ does not. This is a pain in the butt for C++
programmers
I would not say a 'pain in the butt', but I admit there are
circumstances where it can be challenging. OTOH, it makes possible
for implementations to be more efficient than others.
but cheerleaders like you won't admit the ruddy language
has any warts.
Again, please try to stay as polite as possible. C++ has its "dusty
corners" like every language, but we do not go there.
You do your mad typedef preprocessor logic behind
closed doors at midnight and excuse yourself because it isn't really
part of C++.
Please, explain what you mean, maybe it is my english.
It never was my intention.
By any objective measure Java is a simpler language.
automatic vs manual allocation.
Dynamic allocation in C++ is used only in given cases, which are not
to be encoutered by beginners.
number of addressing operators
The language is different, the features are differents.
Since out-of-class functions are legal, there must be a way to
differentiate between pointers to member function and pointers to
'ordinary' functions.
Since pointer arithmetic is legal, there must be a way to dereference
pointers to access the actual value.
Since objects, references and pointers are all represented in the
language, there must be a way to declare and use them.
Java has none of these features and, of course, it is normal that it
lacks the operators to use them.
number of language features
Are we talking about *mastering* or *learning* a language? I agree
C++ has a lot more features and that its syntax is less easy to grasp
on the first look, which makes it a harder programming language to
master, as assembly is harder to master than C++.
But to learn C++ and Java for a beginner is the very same thing.
amount of built in code you don't have to write yourself.
I think you should try to get a bit more informed on C++ libraries
available today. We'll talk about that later if you want.
Schools teach the simplest things first.
Depends on the schools..
I see no reason why computer
languages should be an exception.
Java enforces more structure that C++ does.
Can you explain your point?
After all, every C
spaghetti program is also a legal C++ program.
Whoaa, who's talking about C here? C and C++ are really two different
beasts. It is possible to compile a program written in C using a C++
compiler, but there are many well-known exceptions. Please read more
on that before making statements like that.
And who said C was a spaghetti language? A well-written C program is
as good as a C++ program.
It is good for someone
starting out to get nudged into OO solutions. Then when they flip to
C++ they won't be tempted to revert to C-style coding. They will use
the low level features of C++ only when they are truly needed.
So you are saying it is hard for a beginner to program in an
object-oriented way using C++? I am sorry, but I do not agree at all.
Both languages have their quirks or associated styles and both are
good.
A beginner will not be "tempted to rever to C-style coding" since he
never did some and even if he did, unlearning it is not difficult as
long as you understand the benefits of oop.
Thanks for the recommendation.
We have different design constraints now. Safety is becoming more
important. Speed and RAM consumption are less important.
This is blatant nonsense. Speed is the ultimate goal in programming,
wether it is for games, banking, internet or whatever. RAM
consumption is still a constraint, associated with i/o.
I agree safety has become more important since computers are being
used in every domain. Bugs can make a *lot* of problems, we have all
seen examples of that.
But I think a good C++ programmer and a good Java programmer making
the same program will result in two as safe programs.
Clarity is
becoming more important. The ability to co-ordinate teams on large
projects in becoming more important.
These are empty statements. Explain them.
These are trends. Presumably
new languages will emerge to better fit the evolutionary pressures.
I agree.
The design constraints of Java are a better fit to day that the design
constraints for C++ which was developed two decades ago. A lot has
changed.
C++ was not developed two decades ago, it has been developping for 15
years, until the 98 standard. Since then, a lot of people have been
working on a better C++.
C++ had the albatross of C compatibility which was key to its success,
but which also held it back from being a cleaner language.
What is a clean language is quite a matter of opinion and programming
style.
Java voluntarily copied some of C's mistakes, perhaps so they would be
familiar teddy bears to new programmers.
I take that as a joke
Jonathan