473,395 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

The Future of C++ ?

If you had asked me 5 years ago about the future of C++, I would have
told you that its future was assured for many years to come. Recently,
I have been starting to wonder.

I have been teaching C++ at a local polytechnical school here in
Vancouver, Canada for approximately 8 years. Six years ago, at the
height (or should I say volume?) of the internet bubble, I had 80+
students per semester in my C++ course. Now I am fortunate to have 15
students per semester. What has changed? I believe that students are
no longer interested in learning C++. They would rather learn .NET
languages or Java (my colleages who teach these courses seem to be very
busy!). I believe it is because these other languages are easier to
learn and/or are perceived to be more relevant today.

I do believe that C++ is more difficult to learn than many of these
other languages. Despite my best efforts to make them exciting, I see
the eyes of my students start to glaze over when I start explaining
pointers. When I ask them to tokenize an english sentence (using the
strtok() function) and print the token in reverse order (they need to
declare an array of type char * and save the addresses of the tokens in
this array), I experience near panic from many of my students. But
these concepts need to be taught in a responsible C++ course. As was
pointed out to me recently, Microsoft still requires applicants to
demonstrate a very good knowledge of string manipulation using C-style
strings (none of these fancy string class objects!) when recruiting C++
programmers.

The ironic part is there is still a large demand for C++ developers
here in Vancouver. In fact, the company that I believe employs the
most developers here in Vancouver, employs almost entirely C++
programmers. This company, Electronic Arts (if you have not heard of
them, I guarantee that your kids have -- they create video games) is
only one of several gaming companies here in Vancouver that employ
primarily C++ programmers. Other companies like Kodak, MDSA, Nokia,
MDSI, etc. also employ large numbers of C++ programmers. Not
surprisingly, I have talked to several companies here in Vancouver who
are complaining that they are having difficulty finding C++ developers
and are looking at trying to recruit from abroad (eastern Europe
primarily).

I believe that many of these companies will be forced to migrate away
from C++ in the near future, simply because they will not be able to
find C++ programmers in the future. Soon the baby boomer C++
programmers will begin to retire, then the proverbial @@@@ will really
start to hit the fan!

Please tell me I am wrong, and paint me a view of the future which
includes C++.

Nov 18 '06
190 7871

Greg wrote:
Frederick Gotham wrote:
blangela:
What has changed? I believe that students are
no longer interested in learning C++. They would rather learn .NET
languages or Java (my colleages who teach these courses seem to be very
busy!). I believe it is because these other languages are easier to
learn and/or are perceived to be more relevant today.

I think that a prerequisite to being a decent programmer is to have above
average intelligence. A minority of people have above average intelligence,
and so a minorty of people aspire to be an actual bonafide programmer
programming in languages such as C and C++.

There is no question that programming in C++ requires above average
intelligence. What is very much open to question, however, is whether
that intelligence is needed for programming per se, or whether the
additional intelligence is needed solely to master the complexities of
C++ itself.
What exactly is so damn tough and complex about C++?? Unless you're
writing a parser for it I just don't see the problem.

Nov 27 '06 #101
Mirek Fidler wrote:
>In terms of language advocacy, C++ gives you the tools to build
whatever
quasi-GC system you want (including a true GC). It doesn't bend you
over
and
Actually, I got impression that you suggest that you can build true GC
a library solution for C++. I argue that you cannot (at least not
without special C++ compiler, but that would be equal to adding GC to
language definition).
You can build many quasi-GC systems in C++ (for C++), such as smart
reference-counting pointers. You can also build a few "true" GCs, meaning
"transparent, and operating directly on raw C++ pointers".

You cannot build every conceivable kind of true GC in C++.

The distinction is Java exposes less plumbing, while C++ makes some exposed
plumbing harder to cover-up.

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Nov 27 '06 #102

Earl Purple wrote:
Greg wrote:

It may be instructive to draw some parallels between programming
languages and car transmissions. Programming in C++ is a lot like
driving a car with a manual transmission - both require "above average"
skill than the alternative available technology requires: be it
programming in a managed language or driving a car with an automatic
transmission.
Greg

A better analogy would be between building a car in Java or building
one in C++.

In Java, you would get all the components and put them together,
including the wheels.

In C++ though there is no standard for a wheel because there are some
vehicles, i.e .boats, don't have wheels so there is no need for a
standard. So you have to "reinvent the wheel" or fit one from a 3rd
party manufacturer,
Just like you do for a car.

the only problem with that being that getting their
wheels to fit your vehicle is not always an simple matter, at least not
as straightforward as it is to fitting a standard one, because the
diagnostics of the wheels are such that they have side effects on the
rest of the manufacture of your car.
Actually, wheels are very standardized for various independent and
*incompatible* requirements and always made by third parties. Car
manufacturers buy their wheels and tires from some other source, that
sells cars and/or tires made for automobiles and not for wheelbarrows
or boat trailers (and certainly don't try to be "all of the above"),
and that source is not the same as the people that made the injector
components or the brain.

If we used your analogy it would be more akin to using Java you would
buy all the parts to your new car from the same person. This person
would specify not only the standards to your parts at a whim all their
own that you have to live with, they would also specify, and enforce
every detail of their use and limit your car's design even to the point
of the count of threads on each and every bolt (even for those parts
you did design and manufacturer yourself). In the end, by the time you
where done fighting with the people you bought your wheel from (and
every other part in your car), and ending up with a design totally
different than what you originally intended so that now it's this gas
guzzling monolith with 100's of reduntant but technically flashy
components, you could have designed, manufactured, and sold 10
independent car designs using the modular setup provided by using
several independent third parties using parts you need that are
designed specifically for your needs and not those of some acedemic
designer who has only ever worked on cars on paper that also has to
account for boat trailers, wheelbarrows, bicycles, and every other damn
thing that might have a wheel.

Nov 27 '06 #103

Alf P. Steinbach wrote:
* Earl Purple:
blangela wrote:
I notice that I have not seen a single post in this thread from an
instructor stating that their C++ classes are increasing in size
or even maintaining their size.
Ah, they are getting cleverer at not writing monolithic classes
anymore. Better refactoring
I know that I get students from UBC (one
of the 2 large local uniiversites, the other being SFU) who want to
learn C++. They complain that it is no longer available at UBC. Also,
when I first started teaching C++, there were several other local
colleges doing the same. Now I believe only BCIT (where I teach) is
still doing so.
Course in Java: Here is a computer. We will learn to write applications
that use all the modern features: GUI, hey we can run even in a
browser. Networking - no problem. And we can process concurrently...
Java is very useful because a lot of companies are writing brand new
software in it.

Course in C++: Here is a computer. Now let's get a DOS shell up and
write a console app. And even when you ask the user to type in a
number, there is no method to intercept the key as the user hits it, so
if the user types in "Blah" you have to go back and say "sorry that's
not a number". If we're lucky we might even write our source with the
vi editor where you have to carefully switch between modes because
there's no such thing as Ctrl or Alt so characters mean different
things at different times. C++ is very useful because there's lots of
legacy code out there written in it, usually very badly, and you can
get a job maintaining it.

Now if you are student which do you choose?

On the subject of maintaining a legacy app, yes it makes economic sense
to do so rather than go for the rewrite. You could say the same for the
language itself. Better to maintain it and even add some new features
rather than go back and write a new one from scratch which is simply
much better.

Now everyone in the C++ market seems to be claiming that the language
is used for device drivers or the "embedded" world. Now where is the
university course saying "here is a robot, now we are going to program
some C++ into its microchip". Might just be the way to make it a bit
more exciting. People would like to learn how to program robots. They
look modern. Instead of writing "hello world" and some horrible console
app with cin, we could program it to make us a cup of tea.

Except -- for robots specialized control languages are better than
C++. And in the embedded world one uses restricted dialects of C++ that
aren't really C++. For example, when you remove exceptions from the
language you also remove the whole point of constructors, and what's
left isn't much more than a simple syntactical device (writing p->foo()
rather than p->vt->foo( p ) or CALL( p, foo, () )).
A little off topic here, but I just recently was introduced to a
product called LabView. It provides for a graphical form of
programming. Every program has 2 windows. One window shows the GUI
components which you can drag and size at will. The other window shows
a "flowchart like" or "circuit like" description of the program logic (
a while loop for example, is depicted by a rectangular shape, with
every program step in the loop depicted by a "component"). If you add
a graphical component to the "circuit like" window, it shows up
automatically in the GUI window.

This LabView product has been evolving for many years (20+ perhaps?)
and has just recently (version 8.2 I think) added the ability to create
classes and other OOP constructs. It might actually be a good tool for
introducing programming, becuase of it's graphical nature (easier for
students to picture the logic of a program.). I also found out that
the Lego Mindstorms products (a form of robotic toy that users can
program) uses a version of LabView to program the robots. I suspect it
may not include the version of LabView that supports a form of OOP,
since this is a very recent release. The reference to robotic
programming above brought this to mind.
>
If I were to teach C++ today (I did many years ago) I'd focus on Windows
applications.

E.g., I imagine it's slightly difficult to do a Windows system tray icon
in Java, unless someone has made a C++ library for that for Java.

I think Windows applications comprise the last bastion of C++.

And it's crumbling: most new Windows applications will be .NET based,
and then better written in C#. That leaves C++ as a "glue" language,
e.g. writing those Java platform libraries. Oh well.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 27 '06 #104

blangela wrote:
I agree with you on this point. I know of a Java instructor at my
school who feels it is a waste of time to teach students data
structures or sorting algorthms -- Java provides different container
classes and sorting algorthms to select from, so why should the student
need to learn these topics. I disagree. I feel that there is still
room for the "science" in "computer science".
Well, teaching students how to implement ADT's isn't exactly the
"science" in computer science unless at the same time they analyze each
algorithm's speed and space requirements. Most data structures courses
I have seen don't spend much time on this later aspect and simply skim
over O() notation and spend the rest of the time implementing sort and
search methods on lists and binary trees.

Really, the science part of computer science is rarely used in the
workplace. There is almost no real world situations when you need to
use finite automita for instance but I know of no CS degree that
doesn't have a course, at least, on this kind of thing alone. Most of
these "science" parts have to be looked up every time you need them
because they simply aren't used enough to recall in detail. On the ADT
end, once you have programming techniques in general down it is really
quite trivial to implement a linked list, for example, so spending as
much time on implementing them at college might be time better spent
learning to use them well...something you actually can use.

Really, implementing a tree or list...once you've done it once that's
probably the last time you will. Maybe if you work in C you'll
implement an ADT once every 5 years or something but most other places
have them already and there's simply no need to. Knowing how they are
sometimes implemented is a good thing but I don't think it's the end of
the world if you don't learn it at school.

In all honesty, the best thing to come out of courses that implement
data structures from scratch is general programming and problem solving
skills. If the teacher feels that can be better taught using other
aids then it's rather hard to argue with that.

Nov 27 '06 #105
gn

Noah Roberts schrieb:
Frederick Gotham wrote:
blangela:
What has changed? I believe that students are
no longer interested in learning C++. They would rather learn .NET
languages or Java (my colleages who teach these courses seem to be very
busy!). I believe it is because these other languages are easier to
learn and/or are perceived to be more relevant today.

I think that a prerequisite to being a decent programmer is to have above
average intelligence. A minority of people have above average intelligence,
and so a minorty of people aspire to be an actual bonafide programmer
programming in languages such as C and C++.

No. Programming requires a certain thinking type, that is all. There
are plenty of brilliant people out there that can't program and will
never be able to program beyond the very basics.

For the less bright among us, there's Java.

Actually, for the less bright among us there's language bigotry.

Java programmers are not stupid. If you want to call people stupid you
should have a look at people that purposfully use the least productive
and secure components of a language when not necissary. Those that do
not make use of the tools at their disposal to make themselves more
productive and better programmers.

Well - you're right. Perhaps the best post until now. As I said in my
posts before I prefer C++, but I also think that it depends on the
specific task and at least on the specific preferences of each
programmer! I think a real programmer is generally no stupid person.

Let's have a look on what is learning to program:
1.) You need to learn the syntax and semantics of a specific language
2.) You need to learn thinking like a programmer: conceive a problem /
reduce it to it's basics / develop solutions and translate them to a
good (today mostly object oriented) design / ...

The first point is the easy part, the second is what seperates a high
level programmer from a
I-programmed-my-own-little-game-hobby-programmer.
So if the distribution of the total programming skill is
1.) 5% and 2.) 95% for java it may be
2.) 7% and 2.) 93% for C++

But you will never be good at point 2 if you don't know anything about
the underlying mechanisms of a language. Also for people programming in
higher languages it is therefore also useful to learn a "low-level"
language (that must not be C or C++). For example I have seen many
errors in python programs of people who started with that language
because they just did not realize the concept of having only references
(the typical beginners errors because they don't know when and why
references are copy on write and when not...).

Best regards,
gn

Nov 27 '06 #106

gn wrote:
Let's have a look on what is learning to program:
1.) You need to learn the syntax and semantics of a specific language
2.) You need to learn thinking like a programmer: conceive a problem /
reduce it to it's basics / develop solutions and translate them to a
good (today mostly object oriented) design / ...

The first point is the easy part, the second is what seperates a high
level programmer from a
I-programmed-my-own-little-game-hobby-programmer.
So if the distribution of the total programming skill is
1.) 5% and 2.) 95% for java it may be
2.) 7% and 2.) 93% for C++
I'm not sure what these invented statistics are supposed to even mean
but whatever. Really, someone good at 2 can work on anything in any
language. Everyone has their preferences but a programmer that is only
able to work in their prefered language isn't very good.

Nov 27 '06 #107
* Earl Purple:
>
So you are admitting that C++ is effectively dying as an application
programming language but will probably remain for the low-level systems
program for a non-embedded platform.
No, I'm speculating. Of course those speculations aren't worth more
than you've paid for them... On the other hand, speculating again, yes,
that's about the way I see it.

We have a little window right now where introductory languages like
Javascript are in practice too limited, so that there's no Real Easy
path into programming, and C and C++ score points on that (no big
problem being complex when it's all complex no matter the path). E.g.
no common script host environment provides decent graphics capability,
while in the old days any decent Basic except perhaps Bill Gates' own
version would give you graphics capability, and that was the first the
young programmer was exposed to. And languages especially geared
towards learning, like Logo and Alice, while providing simple graphics,
are just too limited in other ways, they're not "real" languages.

However, that's changing fast, with the serious functionality migrating
upwards to simpler languages. Then there will be very few reasons for a
student to dip into C or C++, because almost whatever one wants to do,
there will then be a much easier path. And so very few programmers will
know anything more about C++ than that its syntax is curly braces, and
that it's associated with some vague notion of very complex dark magic.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 28 '06 #108

"kwikius" <an**@servocomm.freeserve.co.ukwrote in message
news:11**********************@j44g2000cwa.googlegr oups.com...
>
Tony wrote:
>"kwikius" <an**@servocomm.freeserve.co.ukwrote in message
news:11**********************@l39g2000cwd.googleg roups.com...
A big problem is the libraries. There are often questions on
comp.lang.c++ regarding Graphics and a GUI on the one hand and also
vehement responses on the other that C++ doesnt need a standard GUI or
graphics libraries There seems to be powerful interests at work. It is
surely in some peoples interests that C++ does become ever more
complicated with out any actual usability features (e.g libraries for
common tasks) and more and more newcomers will simply stick with Java
and C# and so on, where they can get the libraies off the nearest
shelf.

Someone else please chime in on the availability of C++ libraries. There
is
a lot of them available. I think what you are saying is that you don't
want
to shop/evaluate/choose from a number of them (?).

I don't and more to the point beginners to the language don't or rather
won't. They will and do already use another language where those
libraries are available. Supermarkets are more successful than
specialists. Why, because people havent got the time to go around all
the specialist shops individually. Most things people want in a
supermarket are similar and 'good enough', and there is nothing
stopping them going to a speciailist if they wish. Further in the
supermarket everything is compatible "generic" (e.g barcodes), feedback
on one product can be used for others. cross fertilisation occurs
formally and informally The supermarket is also a meeting place for
people who want different products, so you can usually get advice from
someone in there as to whether some product is good or not.

Go ask in the specialist shop and their particular product is bound to
be marvellous of course.
I consider having a choice of many an asset, but agree that most people
are cognitively lazy.

Tony
Nov 28 '06 #109

"Earl Purple" <ea********@gmail.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
>
Tony wrote:
>>
If I was an instructor at a university, I would NOT put templates into a
first semester class. That's an advanced and additional paradigm and
requires choice to "buy into" IMO. I view C++ as a smorgasbord: I'll
eat what I want and like (no sushi for me!).

I would. Collections would be one of the first subjects I would teach.

One of the least important features of C++ is cin. I do not have a
single cin in any of my C++ production code. Yet it seems to be the
first thing programmers seem to learn.
>Actually, even before C++, it would probably be better to take a
general studies course on programming paradigms! Then students can
take C++ as an course tailored to their needs. (No, that won't work,
cuz students by definition can't make that choice). Oh well, something
like that then.

Surely paradigms though must include handling collections.
A good way for students to learn would be to create some of their
own containers. That would lead naturally to templates. I wouldn't
consider "containers" a paradigm like template programming is.

Tony
Nov 28 '06 #110

"kwikius" <an**@servocomm.freeserve.co.ukwrote in message
news:11*********************@l39g2000cwd.googlegro ups.com...
>
Tony wrote:
>"kwikius" <an**@servocomm.freeserve.co.ukwrote in message
news:11**********************@l39g2000cwd.googleg roups.com...
There is no money behind C++ except from companies and maybe many of
their interests lie elsewhere.

Whatever that means.
Its the lack of good libraies that will kill C++ AFAICS.

Example please. What area is missing "good libraries" and what would,
for you, make it a "good" library? (Perhaps FREE?)

"Standard". GUI, graphics, dlls, IPC, concurrency.
OK, so you just want them to be standard. That assumes that the proprietary
vendors would give up control of those things though. I can't imagine MS
giving up its cash cow by adhering to a standard GUI API.

Tony
Nov 28 '06 #111

"Alf P. Steinbach" <al***@start.nowrote in message
news:4t*************@mid.individual.net...
For example, when you remove exceptions from the language you also remove
the whole point of constructors, and what's left isn't much more than a
simple syntactical device (writing p->foo() rather than p->vt->foo( p ) or
CALL( p, foo, () )).
That doesn't sound correct at all. Constructor + copy constructor +
destructor
+ assignment operator allow creation of objects that act like built-in
types.
Exceptions just solve the problem of how to handle errors in those
functions.
Constructors weren't created as a result of exception handling, EH was
created as a result of constructors.

Tony
Nov 28 '06 #112
Noah Roberts wrote:
Really, the science part of computer science is rarely used in the
workplace. There is almost no real world situations when you need to
use finite automita for instance but I know of no CS degree that
doesn't have a course, at least, on this kind of thing alone.
I think the idea is to teach us to think in terms of state transitions.
Whether we recall the vocabulary and diagram techniques immediately, or
not, we should have integrated the approach into our thinking.
Most of
these "science" parts have to be looked up every time you need them
because they simply aren't used enough to recall in detail. On the ADT
end, once you have programming techniques in general down it is really
quite trivial to implement a linked list, for example, so spending as
much time on implementing them at college might be time better spent
learning to use them well...something you actually can use.
It really depends on what you are trying to design. It's unlikely I will
write a linked list any time soon, however,
Really, implementing a tree or list...
I am currently writing code that implements a tree in order to solve a
real-world problem.
once you've done it once that's
probably the last time you will. Maybe if you work in C you'll
implement an ADT once every 5 years or something but most other places
have them already and there's simply no need to. Knowing how they are
sometimes implemented is a good thing but I don't think it's the end of
the world if you don't learn it at school.
I believe you are using the term ADT the way I learned it in college, which
is not the way it is typically used among C++ language officionatos. The
use of ADT I learned in school has to do with linked lists and binary
trees. To Stroustrup, Koening and the gang, ADT means an interface
that 'looks like' it has/is data.
In all honesty, the best thing to come out of courses that implement
data structures from scratch is general programming and problem solving
skills. If the teacher feels that can be better taught using other
aids then it's rather hard to argue with that.
It really depends on what you are trying to accomplish. I often find myself
struggling with ways of structuring and representing data.
--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/
Nov 28 '06 #113
"Kai-Uwe Bux" <jk********@gmx.netwrote in message
news:ek**********@murdoch.acc.Virginia.EDU...
Chris Thomasson wrote:
>"Earl Purple" <ea********@gmail.comwrote in message
[snip]
>>Course in Java: [...]
>>And we can process concurrently...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Java memory model is so damn strict that it makes it impossible to create
any high-end synchronization algorithms. Period. But then, does the
average Java programmer even know this fact? I bet 99% do not. Simple
example of how learning Java first can, and will, burn you:
C++ teacher: Now we are going to learn about variable length arrays. C++
has
for instance the deque<template, you see ...

Student: How does C++ actually implement that template?

C++ teacher: That is implementation defined according to the standard. All
I
can tell you for sure are the following guaranteed complexity bounds...
That teacher is crap. Give me a break. A good C++ teacher should make his
students create a vector class from scratch. Heck, the instructor can teach
his students how to implement a vector that meets the C++ Standard. The
instructor can teach the student how to create a memory allocator that meets
the C++ standard to plug into the standard vector the student will be
creating.

The classroom can define a namespace:

myclass_std

And the course would be about actually implementing Standard C++. Then the
students can implement Standard vector, and Standard queue, and use them in
further applications.
Any thoughts on this approach?
Student: I hear the C++ Standard has a nice vector template?

Teacher: Well, yes it does. And you will learn exactly how to create a
Standard C++ vector template from scratch. This class will teach you how to
implement useful parts of the C++ Standard. The class uses the namespace
myclass_std for the minimalist Standard C++ template library you will be
creating.

Sound good to me, no?
Nov 28 '06 #114
"Earl Purple" <ea********@gmail.comwrote in message
news:11**********************@l39g2000cwd.googlegr oups.com...
>
Chris Thomasson wrote:
>>
there's lots of
legacy code out there written in it, usually very badly, and you can
get a job maintaining it.

I hope you don't think that the reason C++ is still around is because of
legacy code?

Of course it is. C++ beat all the other OO languages of its generation
because it supported all the company's existing C source. Read
Stroustrup's pages about the history of the language.
Now if you are student which do you choose?

C++ for sure! You should learn the fundamentals before you choose to
sacrifice yourself to very high-level language that is governed under a
"private" standard.

And then you'd need to learn assembly too plus deep amounts of
electronics to know how all the hardware works.

What if, however, you are the typical student for whom university is
really only the unfortunately necessary and costly step between school
and getting a job, and that your primary aim of university is to be
trained to get a job afterwards, especially since you'll probably have
a big loan to pay off.
Well, highly skilled C/C++ systems programmers get paid more?

And it's the "private standard" that has allowed them to advance Java
to where it is,
introducing generics (really templates) in the latest
standard, plus the equivalent of a foreach which looks a lot cleaner
I don't care about using normal for. I am a C programmer at heart. No
problems here.
Nov 28 '06 #115
"Chris Thomasson" <cr*****@comcast.netwrote in message
news:jI******************************@comcast.com. ..
"Kai-Uwe Bux" <jk********@gmx.netwrote in message
news:ek**********@murdoch.acc.Virginia.EDU...
>Chris Thomasson wrote:
>>"Earl Purple" <ea********@gmail.comwrote in message
[snip]
>>>Course in Java: [...]

And we can process concurrently...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Java memory model is so damn strict that it makes it impossible to
create
any high-end synchronization algorithms. Period. But then, does the
average Java programmer even know this fact? I bet 99% do not. Simple
example of how learning Java first can, and will, burn you:
>C++ teacher: Now we are going to learn about variable length arrays. C++
has
for instance the deque<template, you see ...

Student: How does C++ actually implement that template?

C++ teacher: That is implementation defined according to the standard.
All I
can tell you for sure are the following guaranteed complexity bounds...

That teacher is crap. Give me a break. A good C++ teacher should make his
students create a vector class from scratch. Heck, the instructor can
teach his students how to implement a vector that meets the C++ Standard.
The instructor can teach the student how to create a memory allocator that
meets the C++ standard to plug into the standard vector the student will
be creating.

The classroom can define a namespace:

myclass_std

And the course would be about actually implementing Standard C++. Then the
students can implement Standard vector, and Standard queue, and use them
in further applications.
Any thoughts on this approach?
Student: I hear the C++ Standard has a nice vector template?

Teacher: Well, yes it does. And you will learn exactly how to create a
Standard C++ vector template from scratch. This class will teach you how
to implement useful parts of the C++ Standard. The class uses the
namespace myclass_std for the minimalist Standard C++ template library you
will be creating.

Sound good to me, no?
That might be a good name for a book...
"Implementing Standard C++"


Nov 28 '06 #116
blangela wrote:
If you had asked me 5 years ago about the future of C++, I would have
told you that its future was assured for many years to come. Recently,
I have been starting to wonder.

I have been teaching C++ at a local polytechnical school here in
Vancouver, Canada for approximately 8 years. Six years ago, at the
height (or should I say volume?) of the internet bubble, I had 80+
students per semester in my C++ course. Now I am fortunate to have 15
students per semester. What has changed? I believe that students are
no longer interested in learning C++. They would rather learn .NET
languages or Java (my colleages who teach these courses seem to be very
busy!). I believe it is because these other languages are easier to
learn and/or are perceived to be more relevant today.

I do believe that C++ is more difficult to learn than many of these
other languages. Despite my best efforts to make them exciting, I see
the eyes of my students start to glaze over when I start explaining
pointers. When I ask them to tokenize an english sentence (using the
strtok() function) and print the token in reverse order (they need to
declare an array of type char * and save the addresses of the tokens in
this array), I experience near panic from many of my students. But
these concepts need to be taught in a responsible C++ course. As was
pointed out to me recently, Microsoft still requires applicants to
demonstrate a very good knowledge of string manipulation using C-style
strings (none of these fancy string class objects!) when recruiting C++
programmers.

The ironic part is there is still a large demand for C++ developers
here in Vancouver. In fact, the company that I believe employs the
most developers here in Vancouver, employs almost entirely C++
programmers. This company, Electronic Arts (if you have not heard of
them, I guarantee that your kids have -- they create video games) is
only one of several gaming companies here in Vancouver that employ
primarily C++ programmers. Other companies like Kodak, MDSA, Nokia,
MDSI, etc. also employ large numbers of C++ programmers. Not
surprisingly, I have talked to several companies here in Vancouver who
are complaining that they are having difficulty finding C++ developers
and are looking at trying to recruit from abroad (eastern Europe
primarily).

I believe that many of these companies will be forced to migrate away
from C++ in the near future, simply because they will not be able to
find C++ programmers in the future. Soon the baby boomer C++
programmers will begin to retire, then the proverbial @@@@ will really
start to hit the fan!

Please tell me I am wrong, and paint me a view of the future which
includes C++.
C++ has one major flaw. #
--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/
Nov 28 '06 #117
>
C++ has one major flaw. #
C/C++ and assembly language was used to create C# and Java.
Nov 28 '06 #118
* Tony:
"Alf P. Steinbach" <al***@start.nowrote in message
news:4t*************@mid.individual.net...
>For example, when you remove exceptions from the language you also remove
the whole point of constructors, and what's left isn't much more than a
simple syntactical device (writing p->foo() rather than p->vt->foo( p ) or
CALL( p, foo, () )).

That doesn't sound correct at all.
I'll try to explain, then.

The purpose of a constructor in C++ is to couple allocation and
initialization in one all-or-nothing operation, a transaction.

After a constructor call you either have an initialized object at hand,
or an exception.

In the case of an exception, if the constructor was invoked via new, the
allocated memory has been automatically deallocated: construction is an
all-or-nothing operation, either allocation+initialization, or nothing.

If you remove exceptions, first of all the all-or-nothing functionality
is removed -- you can and will then have improperly initialized
objects accessible -- which defeats the very purpose of constructors.

Second, to be able to handle initialization failure dialects such as
Symbian C++ require the programmer to use two-phase construction where
the "C++" constructor is just a dummy, with an initialization member
function called afterwards by the client code. And with that technique
not only is the purpose of the constructor defeated, but the constructor
has become just a hindrance that must be overcome by some alternative
initialization scheme. Constructors then just add complexity, no gain.

Consider if, in such a thwarted dialect of "C++", a class Base
constructor fails when called automatically from a class Derived
constructor. Perhaps class Derived has some members of type Mambo. To
signal its failure the Base constructor sets the boolean member
'okSoFar' to false. But since that's a scheme the compiler knows
nothing about, the Mambo members are now automatically constructed,
perhaps causing some side-effects such as windows popping up. Now the
Derived constructor's body is executed and it detectes the failed Base
construction, and must communicate that to the client code, somehow...

Constructor + copy constructor +
destructor
+ assignment operator allow creation of objects that act like built-in
types.
Sort of.

Without exceptions you're limited to types where initialization can't
fail, and/or treating all failures as fatal errors, and/or using the
language in a way ignoring constructors.

This was useful enough that C++ enjoyed a fair degree of success without
exceptions, up till the late 1980's, as a "better C", but the section on
error handling in the first edition of TCPPPL tellingly lists the then
current alternatives and finds fault with them all for ordinary function
calls, without even discussing how to handle failure in constructors.

Exceptions just solve the problem of how to handle errors in those
functions.
No, that problem is not a problem that can be solved by other known means.

Constructors weren't created as a result of exception handling, EH was
created as a result of constructors.
No, that's incorrect. Exceptions were adopted late in the
standardization process, that's true. But first, they weren't invented
to support constructors, nor vice versa, and second, they weren't
invented in C++. Experience with exceptions had been gained from Ada
and other languages, as well as at a low level in e.g. Windows NT. They
fitted the requirements of constructors, and no other scheme did.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 28 '06 #119

"Steven T. Hatton" <ch********@germania.supwrote in message
news:Ep******************************@speakeasy.ne t...
>
C++ has one major flaw. #
How is C/C++ or Assembly Language flawed when they are used to create C#
Java?

Please enlighten me on how bad the language is that is used to implement you
favorite "Microsoft controlled super" high-level language?
Nov 28 '06 #120

Steven T. Hatton wrote:
I believe you are using the term ADT the way I learned it in college, which
is not the way it is typically used among C++ language officionatos. The
use of ADT I learned in school has to do with linked lists and binary
trees. To Stroustrup, Koening and the gang, ADT means an interface
that 'looks like' it has/is data.
Abstract Data Type. Any data type that can contain, and work with,
generic data. That is the definition used in both cases.

Nov 28 '06 #121
"Earl Purple" <ea********@gmail.comwrote in message
news:11**********************@l39g2000cwd.googlegr oups.com...
>
Chris Thomasson wrote:
>>
there's lots of
legacy code out there written in it, usually very badly, and you can
get a job maintaining it.

I hope you don't think that the reason C++ is still around is because of
legacy code?

Of course it is. C++ beat all the other OO languages of its generation
because it supported all the company's existing C source. Read
Stroustrup's pages about the history of the language.
[...]
You don't think people use C/C++ for other reasons? What about the fact that
you can easily couple C/C++ with Assembly Language and create C#, Java,
custom lock-free VM, full blown garbage collection, virtually anything you
want!

Try to prototype new types of garbage collector designs in C# or Java,...
Ha!
Nov 28 '06 #122
Chris Thomasson wrote:
>
"Steven T. Hatton" <ch********@germania.supwrote in message
news:Ep******************************@speakeasy.ne t...
>>
C++ has one major flaw. #

How is C/C++ or Assembly Language flawed when they are used to create C#
Java?

Please enlighten me on how bad the language is that is used to implement
you favorite "Microsoft controlled super" high-level language?
Microsoft? Are they still in business? I haven't checked recently.

I believe you missed the entire meaning of my previous post. The one major
flaw in C++ is '#'. Other than that, it is an excellent language.

--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/
Nov 28 '06 #123

"Steven T. Hatton" <ch********@germania.supwrote in message
news:Fu******************************@speakeasy.ne t...
Chris Thomasson wrote:
>>
"Steven T. Hatton" <ch********@germania.supwrote in message
news:Ep******************************@speakeasy.n et...
>>>
C++ has one major flaw. #

How is C/C++ or Assembly Language flawed when they are used to create C#
Java?

Please enlighten me on how bad the language is that is used to implement
you favorite "Microsoft controlled super" high-level language?

Microsoft? Are they still in business? I haven't checked recently.

I believe you missed the entire meaning of my previous post. The one
major
flaw in C++ is '#'. Other than that, it is an excellent language.
Why is the preprocessor bad?
Nov 28 '06 #124

"Steven T. Hatton" <ch********@germania.supwrote in message
news:Fu******************************@speakeasy.ne t...
Chris Thomasson wrote:
>>
"Steven T. Hatton" <ch********@germania.supwrote in message
news:Ep******************************@speakeasy.n et...
>>>
C++ has one major flaw. #

How is C/C++ or Assembly Language flawed when they are used to create C#
Java?

Please enlighten me on how bad the language is that is used to implement
you favorite "Microsoft controlled super" high-level language?

Microsoft? Are they still in business? I haven't checked recently.

I believe you missed the entire meaning of my previous post. The one
major
flaw in C++ is '#'. Other than that, it is an excellent language.
Sorry, I thought you meant C#... You are referencing the preprocessor
correct?
Nov 28 '06 #125
Chris Thomasson wrote:
>
"Steven T. Hatton" <ch********@germania.supwrote in message
news:Fu******************************@speakeasy.ne t...
>Chris Thomasson wrote:
>>>
"Steven T. Hatton" <ch********@germania.supwrote in message
news:Ep******************************@speakeasy. net...

C++ has one major flaw. #

How is C/C++ or Assembly Language flawed when they are used to create C#
Java?

Please enlighten me on how bad the language is that is used to implement
you favorite "Microsoft controlled super" high-level language?

Microsoft? Are they still in business? I haven't checked recently.

I believe you missed the entire meaning of my previous post. The one
major
flaw in C++ is '#'. Other than that, it is an excellent language.

Why is the preprocessor bad?
"Among the facilities, techniques, and ideas C++ inherited from C was the C
preprocessor, Cpp. I didn't like Cpp at all, and I still don't like it.
The character and file orientation of the preprocessor is fundamentally at
odds with a programming language designed around the notions of scopes,
types, and interfaces." Bjarne Stroustrup
--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/
Nov 28 '06 #126
"Steven T. Hatton" <ch********@germania.supwrote in message
news:jf******************************@speakeasy.ne t...
Chris Thomasson wrote:
>"Steven T. Hatton" <ch********@germania.supwrote in message
news:Fu******************************@speakeasy.n et...
>>Chris Thomasson wrote:
"Steven T. Hatton" <ch********@germania.supwrote in message
news:Ep******************************@speakeasy .net...
Why is the preprocessor bad?
"Among the facilities, techniques, and ideas C++ inherited from C was the
C
preprocessor, Cpp. I didn't like Cpp at all, and I still don't like it.
The character and file orientation of the preprocessor is fundamentally at
odds with a programming language designed around the notions of scopes,
types, and interfaces." Bjarne Stroustrup

You can use the C preprocessor to generate C++ code:

http://groups.google.com/group/comp....382dc9a40439c7

I don't see anything wrong with the preprocessor.
Nov 28 '06 #127
Chris Thomasson wrote:
"Kai-Uwe Bux" <jk********@gmx.netwrote in message
news:ek**********@murdoch.acc.Virginia.EDU...
>Chris Thomasson wrote:
>>"Earl Purple" <ea********@gmail.comwrote in message
[snip]
>>>Course in Java: [...]

And we can process concurrently...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Java memory model is so damn strict that it makes it impossible to
create any high-end synchronization algorithms. Period. But then, does
the average Java programmer even know this fact? I bet 99% do not.
Simple example of how learning Java first can, and will, burn you:
>C++ teacher: Now we are going to learn about variable length arrays. C++
has
for instance the deque<template, you see ...

Student: How does C++ actually implement that template?

C++ teacher: That is implementation defined according to the standard.
All I
can tell you for sure are the following guaranteed complexity bounds...

That teacher is crap. Give me a break. A good C++ teacher should make his
students create a vector class from scratch. Heck, the instructor can
teach his students how to implement a vector that meets the C++ Standard.
The instructor can teach the student how to create a memory allocator that
meets the C++ standard to plug into the standard vector the student will
be creating.

The classroom can define a namespace:

myclass_std

And the course would be about actually implementing Standard C++. Then the
students can implement Standard vector, and Standard queue, and use them
in further applications.
Any thoughts on this approach?
When you learned driving a car, did your instructor insist on assembling it
first from parts? Don't get me wrong, I think such a class would be fun and
a great way to learn quite a bit (been there, done that, learned a lot).
However that class would not be a language course. It would be a course in
data structures.

That C++ allows you to implement your own deque does not mean you should. It
does not even mean should know how to do it (there may be *other* reason
why you should know how to implement deque, but those are unrelated to C++
and are better taken care of by other classes in the curriculum).

In my opinion, a C++ course should focus on good programming idioms like
RAII, templated inheritance and policy classes, the use of standard
containers instead of pointers and arrays; the students should learn about
exception safety issues and how templates (user provided code) and
exceptions (when user provided code throws) aggravate the use of raw
pointers; the students need to explore the virtues and vices of being
virtual or of being private, protected, or public; and the list continues.
Those are issues a C++ needs to cover because these items are forced onto
the agenda by the language. A C++ course is neither a substitute for an
introduction to computer architecture nor a class on data structures and
algorithms.

Student: I hear the C++ Standard has a nice vector template?

Teacher: Well, yes it does. And you will learn exactly how to create a
Standard C++ vector template from scratch. This class will teach you how
to implement useful parts of the C++ Standard. The class uses the
namespace myclass_std for the minimalist Standard C++ template library you
will be creating.

Sound good to me, no?
As I said, sounds terrific for a class in data structures. But that is quite
different from teaching C++. The problems of implementing queues, maps,
sets, hash tables, and even something like vector are mostly unrelated to
the language (although it is true that templates help tremendously in
making such structures generic).
Best

Kai-Uwe Bux
Nov 28 '06 #128

Tony wrote:
OK, so you just want them to be standard. That assumes that the proprietary
vendors would give up control of those things though. I can't imagine MS
giving up its cash cow by adhering to a standard GUI API.
That's like saying you can't have proprietary databases because they
have to support standard SQL.

Nov 28 '06 #129
The real solution would be C++2, a new version of the C++ language
(not an extension of the current language). I should avoid the
numerous traps, pitfalls and wrong defaults of the current language.
C++2 could be compatible with (but not a superset of) current C and
C++ (through a compatibility mode). Of course, that's a futile
proposal. That kind of language evolution happens in Python, Ruby,
PHP, ... but not in C++.
An evolution of C++ is already en-route. Have you seen
http://www.digitalmars.com/d/ ?

Nov 28 '06 #130

Silverclaw wrote:
The real solution would be C++2, a new version of the C++ language
(not an extension of the current language). I should avoid the
numerous traps, pitfalls and wrong defaults of the current language.
C++2 could be compatible with (but not a superset of) current C and
C++ (through a compatibility mode). Of course, that's a futile
proposal. That kind of language evolution happens in Python, Ruby,
PHP, ... but not in C++.

An evolution of C++ is already en-route. Have you seen
http://www.digitalmars.com/d/ ?
Yes, there is a big D discussion currently on comp.lang.c++.moderated.

D does not link with your existing C++ libraries. How it might be
useful is if there is a single D runtime library to make libraries
totally portable. They will need, in my opinion, a large number of
standard libraries relating to computing tools such as GUI, networking,
threads, databases, etc.

Nov 28 '06 #131

blangela wrote:
If you had asked me 5 years ago about the future of C++, I would have
told you that its future was assured for many years to come. Recently,
I have been starting to wonder.

I have been teaching C++ at a local polytechnical school here in
Vancouver, Canada for approximately 8 years. Six years ago, at the
height (or should I say volume?) of the internet bubble, I had 80+
students per semester in my C++ course. Now I am fortunate to have 15
students per semester. What has changed? I believe that students are
no longer interested in learning C++. They would rather learn .NET
languages or Java (my colleages who teach these courses seem to be very
busy!). I believe it is because these other languages are easier to
learn and/or are perceived to be more relevant today.

I do believe that C++ is more difficult to learn than many of these
other languages. Despite my best efforts to make them exciting, I see
the eyes of my students start to glaze over when I start explaining
pointers. When I ask them to tokenize an english sentence (using the
strtok() function) and print the token in reverse order (they need to
declare an array of type char * and save the addresses of the tokens in
this array), I experience near panic from many of my students. But
these concepts need to be taught in a responsible C++ course. As was
pointed out to me recently, Microsoft still requires applicants to
demonstrate a very good knowledge of string manipulation using C-style
strings (none of these fancy string class objects!) when recruiting C++
programmers.

The ironic part is there is still a large demand for C++ developers
here in Vancouver. In fact, the company that I believe employs the
most developers here in Vancouver, employs almost entirely C++
programmers. This company, Electronic Arts (if you have not heard of
them, I guarantee that your kids have -- they create video games) is
only one of several gaming companies here in Vancouver that employ
primarily C++ programmers. Other companies like Kodak, MDSA, Nokia,
MDSI, etc. also employ large numbers of C++ programmers. Not
surprisingly, I have talked to several companies here in Vancouver who
are complaining that they are having difficulty finding C++ developers
and are looking at trying to recruit from abroad (eastern Europe
primarily).

I believe that many of these companies will be forced to migrate away
from C++ in the near future, simply because they will not be able to
find C++ programmers in the future. Soon the baby boomer C++
programmers will begin to retire, then the proverbial @@@@ will really
start to hit the fan!

Please tell me I am wrong, and paint me a view of the future which
includes C++.
I guess none here talked about the next standard of C++ the C++0x, that
one may be the solutions for all what is said about C++ complexity and
make it easy_to_learn and easy_to_program language.

In other hand, the C++, is the only language that gives the high rate
of flexibility between the high and the low level of programming.

for more about C++0x; http://www.artima.com/cppsource/cpp0x.html

Best Regards,
Adnane

Nov 28 '06 #132


From: "kwikius" <an**@servocomm.freeserve.co.uk>
Newsgroups: comp.lang.c++
Subject: Re: The Future of C++ ?
Date: Tue, 28 Nov 2006 04:42:40 -0800
Tony wrote:
"kwikius" <an**@servocomm.freeserve.co.ukwrote in message
news:11*********************@l39g2000cwd.googlegro ups.com...

Tony wrote:
"kwikius" <an**@servocomm.freeserve.co.ukwrote in message
news:11**********************@l39g2000cwd.googlegr oups.com...

There is no money behind C++ except from companies and maybe many of
their interests lie elsewhere.

Whatever that means.

Its the lack of good libraies that will kill C++ AFAICS.

Example please. What area is missing "good libraries" and what would,
for you, make it a "good" library? (Perhaps FREE?)
"Standard". GUI, graphics, dlls, IPC, concurrency.

OK, so you just want them to be standard. That assumes that the proprietary
vendors would give up control of those things though. I can't imagine MS
giving up its cash cow by adhering to a standard GUI API.
All I can say is that Microsoft moves in mysterious ways their wonders
to perform.

I am intrigued as to why Microsoft released VC8.0 Express for free
though. I don't know why but speculating and first saying that VC8.0 is
a very capable C++ compiler with a lovely optimiser.

1) They want to introduce C++ coders to .Net.
2) They've given up on C++ and basically chucked VC8.0 like garbage as
their last C++ compiler.
3) gcc is free so they decided to compete on the same playing field.

Who knows... but (if if Microsoft are listening) I do hope there will
be a VC++9.0 though with Concepts:

http://www.generic-programming.org/l...es/conceptcpp/

Beyond the limited horizons of 'implementation defined' C++ though, I
have a funny feeling that the idea of a virtual machine is the way of
the future. Ultimately this is the power of Java and the Microsoft .Net
languages. and its attractive to me and its a standard with cross
platform and cross language libraries... and and.... ;-)
regards
Andy Little

Nov 28 '06 #133
Chris Thomasson wrote:
"Steven T. Hatton" <ch********@germania.supwrote in message
news:jf******************************@speakeasy.ne t...
>Chris Thomasson wrote:
>>"Steven T. Hatton" <ch********@germania.supwrote in message
news:Fu******************************@speakeasy. net...
Chris Thomasson wrote:
"Steven T. Hatton" <ch********@germania.supwrote in message
news:Ep******************************@speakeas y.net...
Why is the preprocessor bad?
"Among the facilities, techniques, and ideas C++ inherited from C was the
C
preprocessor, Cpp. I didn't like Cpp at all, and I still don't like it.
The character and file orientation of the preprocessor is fundamentally
at odds with a programming language designed around the notions of
scopes, types, and interfaces." Bjarne Stroustrup


You can use the C preprocessor to generate C++ code:

http://groups.google.com/group/comp....382dc9a40439c7
>
I don't see anything wrong with the preprocessor.
I have seen Cpp used to effective ends. That is the nicest thing I can say
about it. For just one example of how it can bite you consider this
scenario: I spend 45 minutes agonizing over the names and signatures of
the member functions I want in the public interface of a class. I then
realize that I want DataModel to be an interface, and not an instantiable
class, so I rename it to DataModel_IF, delete the .cpp "implementation"
file and rename DataModel.h to DataModel_IF.h. Then I create a new header
file for the actual class DataModel and call it DataModel.h, and I also
create the corresponding DataModel.cpp. For some reason, none of my code
will compile even though everything looks correct. The errors aren't
making any sense in terms of the code I'm looking at. What's wrong?

--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/
Nov 28 '06 #134

Noah Roberts wrote:
blangela wrote:
If you had asked me 5 years ago about the future of C++, I would have
told you that its future was assured for many years to come. Recently,
I have been starting to wonder.

I have been teaching C++ at a local polytechnical school here in
Vancouver, Canada for approximately 8 years. Six years ago, at the
height (or should I say volume?) of the internet bubble, I had 80+
students per semester in my C++ course. Now I am fortunate to have 15
students per semester. What has changed? I believe that students are
no longer interested in learning C++. They would rather learn .NET
languages or Java (my colleages who teach these courses seem to be very
busy!). I believe it is because these other languages are easier to
learn and/or are perceived to be more relevant today.

Hey, that's great news. Less cheap labor competition makes me a more
expensive commodity. It also makes my life easier when I don't have to
deal with the bozos comming out of college these days. Let them write
horrible crap in C# or Java. I win either way...I can't loose, no way
is C++ going away any time soon, so this can only be good news.

I say make your course tougher. Weed out the idiots for us.
I agree!

Nov 28 '06 #135

Chris Thomasson wrote:
Other that that... When I get back from the meeting, we should include c.p.t
in this conversation.
Well, I have tried to follow links, but I am afraid I am missing the
necessary background...

Could you, for starters, give me a hint what means that
boost::shared_ptr does not have "strong guarantee"?

Does it mean that you cannot access (or write) single shared_ptr
instance from 2 threads?

Mirek

Nov 28 '06 #136
Mirek Fidler wrote:
Chris Thomasson wrote:

>>Other that that... When I get back from the meeting, we should include c.p.t
in this conversation.


Well, I have tried to follow links, but I am afraid I am missing the
necessary background...

Could you, for starters, give me a hint what means that
boost::shared_ptr does not have "strong guarantee"?

Does it mean that you cannot access (or write) single shared_ptr
instance from 2 threads?
Yes, concurrently or atomically, however you'd like to put it.
Similar to Java "pointer" guarantees.
--
Joe Seigh

When you get lemons, you make lemonade.
When you get hardware, you make software.
Nov 28 '06 #137
Steven T. Hatton:
"Among the facilities, techniques, and ideas C++ inherited from C was the C
preprocessor, Cpp. I didn't like Cpp at all, and I still don't like it.
The character and file orientation of the preprocessor is fundamentally at
odds with a programming language designed around the notions of scopes,
types, and interfaces." Bjarne Stroustrup

Did you see the macros I wrote recently in another thread:

POST_IN_TERMS_OF
OP_IN_TERMS_OF
NON_CONST_IN_TERMS_OF

These macros are very handy, and they cut down on programmer time and error.

--

Frederick Gotham
Nov 28 '06 #138
Steven T. Hatton:
The one major flaw in C++ is '#'.

Are you five years old? '#' doesn't mean "preprocessor", never has and never
will. It's nothing more than a symbol which has different names in different
languages and dialects -- I myself call it the hash symbol.

From now on, when I say that there's a problem with '~', you can take it to
mean the mid-Atlantic currents.

--

Frederick Gotham
Nov 28 '06 #139

Chris Thomasson wrote:
Well, you can't use it as a 100% drop in replacement right now because the
interface is a little different. However, it does provides two smart
pointers:
Well, before going into details....

Have you found a way how to implement lock-free reference counting
usable e.g. for COW string? (with "weak" guarantee for string itself)?

If yes, what is the idea, if you are willing to share?

Mirek

Nov 28 '06 #140
Frederick Gotham wrote:
Steven T. Hatton:
>"Among the facilities, techniques, and ideas C++ inherited from C was the
C
preprocessor, Cpp. I didn't like Cpp at all, and I still don't like it.
The character and file orientation of the preprocessor is fundamentally
at odds with a programming language designed around the notions of
scopes, types, and interfaces." Bjarne Stroustrup


Did you see the macros I wrote recently in another thread:

POST_IN_TERMS_OF
OP_IN_TERMS_OF
NON_CONST_IN_TERMS_OF

These macros are very handy, and they cut down on programmer time and
error.
What happens when somebody just happens to define something in a library you
include in your code that breaks your macros? It happens. I recently
spent many hours trying to figure out what was wrong with code I wrote
using macros from a library provider. I started out with a working
prototype based on example code. I modified the design making reasonable
changes which one should expect a programmer to make. Among those changes
was to remove certain header files which appeared to be superfluous, and
were not indicated in the documentation as essential to the feature I was
trying to implement. When I tried to compile the code, I got errors
telling me the macro wasn't being expanded. I located the macro definitions
in a header file with a name which seemed appropriate and included that in
my code. I could see the bloody macro definition right in front of my
eyes, and it was there in a file which I was pulling into the translation
unit. Nonetheless, the macro would not expand. After many hours of trying
reasonable approaches, I tried the brute force approach of simply copying
everything from the original working prototype I could possibly put in the
modified code. Among those elements was a header file which *should* *not*
have made a difference. Nonetheless, it *did* make a difference.

What is even more bizarre is that at one point, explicitly adding a default
constructor signature to a pure abstract base class caused the damn thing
to work!

I just checked a major project I was working with about a year ago because I
was going to use it as an example of what is wrong with macro madness.
Much to my pleasant surprise the macros are GONE! In many (dozens, perhaps
hundreds of) cases they have been replaced with templates.

I believe there is a place for "cookie cutter" code. What Cpp provides is a
means of crossing the boundary between code text, and compiled code. It is
a form of recursive self-reference, if you will pardon the redundancy.
That is actually a very powerful ability. Unfortunately it's provided by a
very weak tool.

This represents one of the most elegant (if the term can even be applied to
macros) uses of Cpp I've ever seen. I once took the entire thing and
turned it into normal source code with about 25 keystrokes using Emacs
regexp search and replace.

http://www.kdevelop.org/HEAD/doc/api...8h-source.html

When I see macros, I consider the time I have spent trying to fix Cpp
related problems, and they never seem to have the potential for saving that
much time.
--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/
Nov 28 '06 #141
kwikius wrote:
>
All I can say is that Microsoft moves in mysterious ways their
wonders to perform.

I am intrigued as to why Microsoft released VC8.0 Express for free
though. I don't know why but speculating and first saying that
VC8.0 is a very capable C++ compiler with a lovely optimiser.

1) They want to introduce C++ coders to .Net.
They want to introduce everyone to .Net, so all the the Express compilers
are free.
2) They've given up on C++ and basically chucked VC8.0 like garbage
as their last C++ compiler.
No, they have really learned a lesson from their earlier free editions -
those without an optimizer. That earned them a "Microsoft compilers suck"
verdict.
3) gcc is free so they decided to compete on the same playing field.
Perhaps.
Bo Persson
Nov 28 '06 #142
Frederick Gotham wrote:
Steven T. Hatton:
>The one major flaw in C++ is '#'.


Are you five years old? '#' doesn't mean "preprocessor", never has and
never will. It's nothing more than a symbol which has different names in
different languages and dialects -- I myself call it the hash symbol.

From now on, when I say that there's a problem with '~', you can take it
to mean the mid-Atlantic currents.
Other than the one OOP programming course I took over a decade ago, and one
course in C I took even longer ago, I taught myself C++ starting about two
years ago. I believe I know it fairly well by now. I can say with
confidence and conviction that problems relating to Cpp were by far the
biggest obstacle, followed by problems related to linking. What I am
trying to tell anybody who is interested in what makes C++ hard to learn is
that the "real" language isn't the problem. Cpp is.

--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/
Nov 28 '06 #143
Frederick Gotham wrote:
For instance, let's say I'm driving fast, but there's a bend up ahead. I
want to get through that bend as quickly as possible. Driving an automatic,
I'll break as I approach the bend, then turn, then accelerate once I'm
through the turn. Driving a manual, I'll drop a gear as I approach the
bend, then the car will slow as I re-engage the engine dragging the revs
up, then I'll turn, then when I'm through the turn, I'll slip the clutch
and acclerate. The automatic method is certainly simpler, but the manual
method is far more efficient.
Using the engine to slow down the car is not efficient. It puts
excessive wear on the engine as unburned fuel in the cylinders will wash
the oil off the cylinder walls, causing more wear. It wastes fuel.

Use the brakes. That's what the darned things are for! They're a lot
cheaper to replace than the engine is.

Proper maximum performance turning technique is:

1) Brake as late as possible, and as hard as possible (just up to
locking, but not actually locking, the tires), just before turning the
wheel.

1.5) While braking, heel-toe double clutch to insert the transmission
into the right gear for the turn exit. Engage the clutch *before*
finishing braking, which also means 'feeling' the engine revs to match
up with the transmission speed so there is no slipping.

2) Turn the wheel while releasing the brake in a coordinated manner so
the turning force takes up where the braking force leaves off.

3) Keep constant pressure on the gas, adding or releasing pressure will
cause a slide.

4) After the apex, gradually straighten the wheel applying pressure to
the gas, again in a coordinated manner to keep constant pressure on the
wheels at just short of skidding.

There are some nuances to this to get even better performance once one
gets smooth at it. It takes a fair amount of practice to do it right,
though. Probably less than 0.1% of drivers can do it. That's why race
car drivers get paid the big bucks <g>.
Nov 28 '06 #144

Walter Bright wrote:
Frederick Gotham wrote:
For instance, let's say I'm driving fast, but there's a bend up ahead. I
want to get through that bend as quickly as possible. Driving an automatic,
I'll break as I approach the bend, then turn, then accelerate once I'm
through the turn. Driving a manual, I'll drop a gear as I approach the
bend, then the car will slow as I re-engage the engine dragging the revs
up, then I'll turn, then when I'm through the turn, I'll slip the clutch
and acclerate. The automatic method is certainly simpler, but the manual
method is far more efficient.

Using the engine to slow down the car is not efficient. It puts
excessive wear on the engine as unburned fuel in the cylinders will wash
the oil off the cylinder walls, causing more wear. It wastes fuel.
Unless of course, its an electric car. In which case the most efficient
way to brake is to use the motor as a dynamo to charge the batteries.
The software for which should obviously be written in C++ . And of
course the best way to save fuel is to drive sensibly, anticipating the
bend ahead well before you reach it. This saves both fuel and brake
wear. Again some suitable C++ software could be used to monitor the
optimum rate of decceleration for economy or even connected the cars
automatic navigation system to a satnav, so I can just sit back and
work on my C++ applications while my electric car automatically takes
me where I need to go.

BTW did you know we missed wombat day this year? :-(

regards
Andy Little

Nov 28 '06 #145

kwikius wrote:
BTW did you know we missed wombat day this year? :-(
Just so everyone doesnt forget next years wombat day:

http://www.wombania.com/wombats/index.htm

regards
Andy Little

Nov 28 '06 #146
Walter Bright:
Frederick Gotham wrote:
>For instance, let's say I'm driving fast, but there's a bend up ahead.
I want to get through that bend as quickly as possible. Driving an
automatic, I'll break as I approach the bend, then turn, then
accelerate once I'm through the turn. Driving a manual, I'll drop a
gear as I approach the bend, then the car will slow as I re-engage the
engine dragging the revs up, then I'll turn, then when I'm through the
turn, I'll slip the clutch and acclerate. The automatic method is
certainly simpler, but the manual method is far more efficient.

Using the engine to slow down the car is not efficient.

Not efficient in terms of what? Racing performance or car maintenance? It
slows the car down at an appropriate rate without using any energy. The
breaks, on the other hand, use energy.

It puts excessive wear on the engine as unburned fuel in the cylinders
will wash the oil off the cylinder walls, causing more wear. It wastes
fuel.

Actually, I think most cars cut off the petrol supply when they sense that:

(1) The accelerator isn't depressed.
(2) The revs are falling below minimum.

I've never heard of "cluth-engage braking" wearing the engine, no more so
than simply reving the engine.

Use the brakes. That's what the darned things are for! They're a lot
cheaper to replace than the engine is.

Actually, people who have driven both manual and automatic argue the exact
opposite: Breaks wear quicker in an automatic, and they're more expensive
to replace than a clutch. My own father drove an automatic for about a
decade, then a manual for about five years, and now he's back in an
automatic. He says that he spent much more money on maintenance for the
automatics, particularly the brakes.

Proper maximum performance turning technique is:

1) Brake as late as possible, and as hard as possible (just up to
locking, but not actually locking, the tires), just before turning the
wheel.

If the objective is to slow down _as_ _fast_ _as_ _possible_, then yes.
This method is a little extreme though if you're driving through a
neighourhood.

1.5) While braking, heel-toe double clutch to insert the transmission
into the right gear for the turn exit. Engage the clutch *before*
finishing braking, which also means 'feeling' the engine revs to match
up with the transmission speed so there is no slipping.

If I'm not mistaken, not even competitive drivers double-clutch anymore,
ever since the advent of synchromeshes in the gear box. I belive the "drop
a gear and engage the clutch dragging up the revs" braking method is
superior, as the revs are just at the right rate when you want to
accelerate out of the turn. If you need more stopping power, then you can
always push the brake at the same time.

2) Turn the wheel while releasing the brake in a coordinated manner so
the turning force takes up where the braking force leaves off.

Sounds good.

3) Keep constant pressure on the gas, adding or releasing pressure will
cause a slide.

Not too sure on this one. I did a race course there a little while ago, and
all I did was brake in a straight line, then release the brake and turn the
wheel. When through the apex of the turn, I hit the accelerator hard. (I
didn't hold on the accelerator going through the turn.)

4) After the apex, gradually straighten the wheel applying pressure to
the gas, again in a coordinated manner to keep constant pressure on the
wheels at just short of skidding.

I take it you don't do drifting :)

There are some nuances to this to get even better performance once one
gets smooth at it. It takes a fair amount of practice to do it right,
though. Probably less than 0.1% of drivers can do it. That's why race
car drivers get paid the big bucks <g>.

I don't think race car drivers do heal-toe or double-clutching anymore. As
far as I'm aware, it's best to take advantage of synchromeshes if they're
there.

In normal driving, the main advantages of "clutch-engage-drag-up-revs
braking" is that the brakes don't get worn, and that you're at a nice rev-
rate when you're exiting the turn.

In race driving, use of this braking method will help keep the brakes cool,
plus you'll be at a nice rev-rate when leaving the turn.

That said though, double-clutching is good fun. I used to do it... until I
needed a new clutch. I tried heal-toe braking one time but I nearly caused
an "accident".

I don't know the exact physics behind it, but I find that intentionally
slipping the clutch upon exiting a turn gives that extra little bit of
acceleration (might be something to do with torque but I don't know).

--

Frederick Gotham
Nov 28 '06 #147
Steven T. Hatton:
What happens when somebody just happens to define something in a library
you include in your code that breaks your macros? It happens.

What happens when someone hits their finger with a hammer? Do we stop
selling hammers?

I recently spent many hours trying to figure out what was wrong with code
I wrote using macros from a library provider. I started out with a
working prototype based on example code. I modified the design making
reasonable changes which one should expect a programmer to make. Among
those changes was to remove certain header files which appeared to be
superfluous, and were not indicated in the documentation as essential to
the feature I was trying to implement.

So why did you have these header files included in the first place?

When I tried to compile the
code, I got errors telling me the macro wasn't being expanded. I located
the macro definitions in a header file with a name which seemed
appropriate and included that in my code. I could see the bloody macro
definition right in front of my eyes, and it was there in a file which I
was pulling into the translation unit. Nonetheless, the macro would not
expand. After many hours of trying reasonable approaches, I tried the
brute force approach of simply copying everything from the original
working prototype I could possibly put in the modified code. Among
those elements was a header file which *should* *not* have made a
difference. Nonetheless, it *did* make a difference.

It didn't by any chance have:

#undef MY_SPECIAL_MACRO

What is even more bizarre is that at one point, explicitly adding a
default constructor signature to a pure abstract base class caused the
damn thing to work!

Sounds a little odd, I'd have to look at the code to see what's happening.

I just checked a major project I was working with about a year ago
because I was going to use it as an example of what is wrong with macro
madness. Much to my pleasant surprise the macros are GONE! In many
(dozens, perhaps hundreds of) cases they have been replaced with
templates.

I believe there is a place for "cookie cutter" code. What Cpp provides
is a means of crossing the boundary between code text, and compiled
code.

And it's very handy, as shown by my IN_TERMS_OF macros.

It is a form of recursive self-reference, if you will pardon the
redundancy. That is actually a very powerful ability. Unfortunately
it's provided by a very weak tool.

The preprocessor is just fine as far as I'm concerned. I just hope we get
Variable Length Argument List macros also.

This represents one of the most elegant (if the term can even be applied
to macros) uses of Cpp I've ever seen. I once took the entire thing and
turned it into normal source code with about 25 keystrokes using Emacs
regexp search and replace.

http://www.kdevelop.org/HEAD/doc/api...8h-source.html

You should see some of the works of genius they churn out over on
comp.lang.c. Ever heard of IMAX_BITS?

When I see macros, I consider the time I have spent trying to fix Cpp
related problems, and they never seem to have the potential for saving
that much time.

I think they're great, C++ would be less of a language without them.

--

Frederick Gotham
Nov 28 '06 #148

"kwikius" <an**@servocomm.freeserve.co.ukwrote in message
news:11*********************@j44g2000cwa.googlegro ups.com...
>

From: "kwikius" <an**@servocomm.freeserve.co.uk>
Newsgroups: comp.lang.c++
Subject: Re: The Future of C++ ?
Date: Tue, 28 Nov 2006 04:42:40 -0800
Tony wrote:
>"kwikius" <an**@servocomm.freeserve.co.ukwrote in message
news:11*********************@l39g2000cwd.googlegr oups.com...
>
Tony wrote:
"kwikius" <an**@servocomm.freeserve.co.ukwrote in message
news:11**********************@l39g2000cwd.googleg roups.com...

There is no money behind C++ except from companies and maybe many of
their interests lie elsewhere.

Whatever that means.

Its the lack of good libraies that will kill C++ AFAICS.

Example please. What area is missing "good libraries" and what would,
for you, make it a "good" library? (Perhaps FREE?)

"Standard". GUI, graphics, dlls, IPC, concurrency.

OK, so you just want them to be standard. That assumes that the
proprietary
vendors would give up control of those things though. I can't imagine MS
giving up its cash cow by adhering to a standard GUI API.

All I can say is that Microsoft moves in mysterious ways their wonders
to perform.

I am intrigued as to why Microsoft released VC8.0 Express for free
though.
Because they released it as cripple-ware in hopes that you'd upgrade to the
fully featured version.
Beyond the limited horizons of 'implementation defined' C++ though, I
have a funny feeling that the idea of a virtual machine is the way of
the future. Ultimately this is the power of Java and the Microsoft .Net
languages. and its attractive to me and its a standard with cross
platform and cross language libraries... and and.... ;-)
..Net standard and cross-platform??

Tony
Nov 28 '06 #149

"Earl Purple" <ea********@gmail.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.com...
>
Tony wrote:
>OK, so you just want them to be standard. That assumes that the
proprietary
vendors would give up control of those things though. I can't imagine MS
giving up its cash cow by adhering to a standard GUI API.

That's like saying you can't have proprietary databases because they
have to support standard SQL.
Not really, because the multi-billion dollar proprietary cow is pre-existing
and standardizing a GUI API threatens its existence. Other products based
upon the standard API would probably have to be successful in taking away
market share before MS would change Windows.

Tony
Nov 28 '06 #150

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

47
by: David Eng | last post by:
> For many years now enterprise business application development has > been the core area for the use of C++. > Today a significant share to this segment has already been lost to > SUN's Java...
35
by: GTO | last post by:
I do not believe that C# is the future of C++. I also do not believe that adding two thousand new library functions to the standard library is the future of C++. But what is the future of C++? Is...
9
by: Lyle Fairfield | last post by:
It's confusing. Many people here and elsewhere make many different predictions: There's an introduction mentioning some aspects of this at...
2
by: | last post by:
Everything seems to be moving to .NET and VC++ seems to be adding a lot of managed code support every new release. The questions: is unmanaged code in VC++ beeing phased out in favour of managed...
0
by: Fuzzyman | last post by:
Hello all, The following is a copy of a blog entry. It's asking a question about future statements and the built in compile function. I'd appreciate any pointers or comments about possible...
29
by: Zootal | last post by:
My apologies if this gets asked/discussed a lot. With c# rampaging through corporate USA (and other countries), what impact will this have on the usage and future of c++? I've used both of them a...
6
by: rohayre | last post by:
Im a long time java developer and actually have never done anything with java scripting. I'd like to write a short simple script for calculating a date in the future based on today's date and a...
5
by: KimmoA | last post by:
Does C have a future? I'd like to think so, but nobody seems to agree with me. Of course, I don't use C in my profession, and maybe I wouldn't be using it if I had the pressure to actually produce...
51
by: Jon Harrop | last post by:
If Microsoft turn F# into a product and place it alongside C# and VB, will many people migrate from C# to F#? -- Dr Jon D Harrop, Flying Frog Consultancy http://www.ffconsultancy.com/products/?u
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.