C++ for Windows development

P

plasticsunrise

Scenario: programming GUI applications in Windows.

If I need speed, I'll use C. If I need object orientation I'll use C#
(which facilitate the creation of the user interface as well).

So my question is, in today's windows programming world, where does c++
fit? What's the reason that leads to develop in C++ today (unless you
are a C++ veteran, so programming in C++ is justified by the fact that
it's your favorite language)?

Thanks,

sunrise
 
M

mlimber

Scenario: programming GUI applications in Windows.

If I need speed, I'll use C. If I need object orientation I'll use C#
(which facilitate the creation of the user interface as well).

So my question is, in today's windows programming world, where does c++
fit? What's the reason that leads to develop in C++ today (unless you
are a C++ veteran, so programming in C++ is justified by the fact that
it's your favorite language)?

You're just asking for a flame war. Search the archives of this group
for twenty discussions of this same question. See also this FAQ from
Bjarne Stroustrup, the creator of C++, and the five or six that follow
for our standard answers:

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

Cheers! --M
 
D

Daniel T.

Scenario: programming GUI applications in Windows.

If I need speed, I'll use C. If I need object orientation I'll use C#
(which facilitate the creation of the user interface as well).

So my question is, in today's windows programming world, where does c++
fit? What's the reason that leads to develop in C++ today (unless you
are a C++ veteran, so programming in C++ is justified by the fact that
it's your favorite language)?

(I figure this is a troll, but what the heck...)

a) The need for speed and the "need" for object orientation aren't
mutually exclusive.

b) There is a big wide world out there that doesn't revolve around
programming GUI applications in Windows.
 
T

tragomaskhalos

Scenario: programming GUI applications in Windows.

If I need speed, I'll use C. If I need object orientation I'll use C#
(which facilitate the creation of the user interface as well).

So my question is, in today's windows programming world, where does c++
fit? What's the reason that leads to develop in C++ today (unless you
are a C++ veteran, so programming in C++ is justified by the fact that
it's your favorite language)?

Thanks,

If we restrict the argument to .NET here, given the choice I personally
would choose C++/CLI, which is probably just about mature enough by
now. This gives me everything that yer C#s and VB.NETs do in terms of
ease of knocking together a UI, plus I get the full expressive power of
C++. And I can write "unmanaged" code for speed if I need to (unlikely
in a UI, but anyway). The commercial reality however is that it is
unlikely to displace C# for mainstream Windows development.
 
P

plasticsunrise

Daniel said:
(I figure this is a troll, but what the heck...)

Hi Daniel,

I'm sorry if the question seemed trollish. But I'm not a troll, I'm
just trying to evaluate what languages I should spend my nights on :)
a) The need for speed and the "need" for object orientation aren't
mutually exclusive.

That's a very good point. I'm wondering though if there is any real
difference of speed between C++ .NET applications and C#.NET given that
they both generate IL code.
Can I create an application that uses unmanaged C++ for speed and
managed C++ for the graphical part?
b) There is a big wide world out there that doesn't revolve around
programming GUI applications in Windows.

I agree. However in the question I've limited the scope on purpose,
because the type of applications that I'm going to develop will be
mathematics tools (hence the need for speed for crunching numbers) and
they will be GUI tools on Windows.

Thanks in advance.

sunrise
 
P

plasticsunrise

tragomaskhalos said:
If we restrict the argument to .NET here, given the choice I personally
would choose C++/CLI, which is probably just about mature enough by
now. This gives me everything that yer C#s and VB.NETs do in terms of
ease of knocking together a UI, plus I get the full expressive power of
C++.

I see what you mean. I was under the false impression that C# was more
"expressive" than C++, but here you said the opposite. Do you mean C++
is more powerful being slightly more low level? Can I access pointers
in C++ even if I am using managed code?
And I can write "unmanaged" code for speed if I need to (unlikely
in a UI, but anyway).

Ok I like the idea of the combo. Speaking of speed, how does C++
"unmanaged" compares with C for mathematical crunching?
The commercial reality however is that it is
unlikely to displace C# for mainstream Windows development.

Why is this the case. Is it because Microsoft pushes more C#, because
the language is easier than C++ or for some other reason?

Thanks in advance.

sunrise
 
P

Phlip

plasticsunrise said:
I'm sorry if the question seemed trollish. But I'm not a troll, I'm just
trying to evaluate what languages I should spend my nights on :)

We frequently get questions asking to compare closely related things on
merit. Cross-posting to C++ and Java "I heard that Java is faster" will
work wonders there! No worries.
That's a very good point. I'm wondering though if there is any real
difference of speed between C++ .NET applications and C#.NET given that
they both generate IL code.
Can I create an application that uses unmanaged C++ for speed and managed
C++ for the graphical part?

Write code in the language most convenient for the programmer. That would
be a language such as Ruby, with dynamic typing and block closures. (You
may notice the languages pimped by the big companies all suck, hence
languages that earn a following _without_ Daddy Warbucks helping them tend
to rock...)

When you actually find out what's slow, port that to un-managed C++.

Learn both languages, so you _can_ port.
I agree. However in the question I've limited the scope on purpose,
because the type of applications that I'm going to develop will be
mathematics tools (hence the need for speed for crunching numbers) and
they will be GUI tools on Windows.

Exactly. Here's a number cruncher:

http://www.zeroplayer.com/cgi-bin/wiki?TestFlea

Click on a green bar.

The high-level part of that program is written in Ruby. That's the source
in the parchment area to the right. The screen shot on the left is a C++
program that hosts a Ruby interpreter. This runs the Ruby command, and
dispatches a series of commands to a back-end renderer. The program
supports both OpenGL (shown) and POVray. Both of those are written in a C
language.
 
R

Roland Pibinger

Scenario: programming GUI applications in Windows.
If I need speed, I'll use C. If I need object orientation I'll use C#
(which facilitate the creation of the user interface as well).
So my question is, in today's windows programming world, where does c++
fit?

Nowhere, except for maintaining now 'legacy' MFC (ATL, ...)
applications.
What's the reason that leads to develop in C++ today (unless you
are a C++ veteran, so programming in C++ is justified by the fact that
it's your favorite language)?

On the Windows platform the future belongs to C#.NET. With the slow
but steady decline of MFC C++ will also disappear there.

Best wishes,
Roland Pibinger
 
S

sunrise

Phlip said:
The high-level part of that program is written in Ruby. That's the source
in the parchment area to the right. The screen shot on the left is a C++
program that hosts a Ruby interpreter. This runs the Ruby command, and
dispatches a series of commands to a back-end renderer. The program
supports both OpenGL (shown) and POVray. Both of those are written in a C
language.

This may be interesting. I'm a Ruby programmer, but as you said, for
mathematical crunching is not suitable. I'll consider it.
 
T

tragomaskhalos

I see what you mean. I was under the false impression that C# was more
"expressive" than C++, but here you said the opposite. Do you mean C++
is more powerful being slightly more low level? Can I access pointers
in C++ even if I am using managed code?

Yes C++ is more powerful being more low-level, but my point was it's
also more powerful because it has "advanced" things like templates and
RAII that allow you to code more succinctly and expressively; "smarter"
rather than "faster" if you like. By contrast I can't think of a single
feature of C# that could be considered as making it more expressive
than C++.
Wrt pointers in managed code, you can do certain things in both managed
C++ and C#, but this is necessarily constrained by the runtime.
Ok I like the idea of the combo. Speaking of speed, how does C++
"unmanaged" compares with C for mathematical crunching?

Endless debate about this; but there should be no difference if you use
C++-as-a-better-C, and even pure C++ mechanisms like polymorphism and
exceptions in reality only add a tiny overhead.
Why is this the case. Is it because Microsoft pushes more C#, because
the language is easier than C++ or for some other reason?

Historically - ie in the DNA days - using C++ for UI development and
indeed for COM development was not for the fainthearted, and most of
the time VB6 did an adequate job. This "fear of C++" has continued into
the .NET world, and the original "C++ with managed extensions" that M$
brought out did nothing to alleviate this. C++/CLI solves most of the
problems, but it's too late, C# has become established. And to be fair
C# is still easier than C++ for your average Joe developer.

It's also worth noting that in their eagerness to market C#, M$ spread
their own fog of FUD over C++. For example a lot of rubbish was/is
talked about the alleged "superiority" of generics over templates, some
of which could be read on MSDN.
 
S

sunrise

tragomaskhalos said:
Yes C++ is more powerful being more low-level, but my point was it's
also more powerful because it has "advanced" things like templates and
RAII that allow you to code more succinctly and expressively; "smarter"
rather than "faster" if you like. By contrast I can't think of a single...

Thanks for your insightful comments.

sunrise
 

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
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top