473,889 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is C++/CLI gaining any traction???

I've been looking for a new IT position, and so far, the majority of
work with respect to the Windows platform is C#/.Net, with some vb.net
requests every so often. Even many of the C++/MFC/ATL position are ones
in which the companies are looking to migrate this to C# and .Net. I
have NOT even seen one position requesting C++/CLI, let alone any
recruiters who have even heard of it!

I can understand those companies looking to create new applications
looking to start with C#, since it is the new trendy language and one
made specifically for .net, but I would think those looking to migrate
their C++/Win32/MFC/ATL stuff, would be looking at the new and improved
C++/CLI to migrate those portions which make sense to integrate .net.

Instead, I've mostly seen the following types of positions with respect
to C++ on Windows:

1) New apps with C#/.Net requested, and some vb.net only
2) Port all native C++ apps to C#/.Net
3) Stick with native C++, with no .Net at all

Like I mentioned, I can understand 1) since if your going to create new
..Net stuff, might as well use the language built specifically for it.
3) I can understand, since if you have native stuff already that is
working well for you, and especially if its apps with performance and
portability in mind, there is no reason to go .net.

2) though, is what I think is nuts! Looks like some companies have
bought into the .net hype, and are under the notion that they need to
convert their native C++ apps completely to a C# one. Sadly, they don't
seem to know that they can use C++/CLI to extend and preserve their
existing native C++ code. C++/CLI is the perfect candidate for this
type of migration, yet no one seems to be aware of it!

I can only conclude a few things: 1) C++/CLI came too late. This should
have been the first language to come out, instead of the horrendous
managed C++. 2) Microsoft has done a lackluster job of marketing
C++/CLI. 3) My feeling is that the hardcore C++ programming shop could
care less about .Net, and furthermore, I think there is quite some
resistance about a .Net extended language of C++. Just read some of the
newsgroups like comp.lang.c++ or comp.lang.c++.m oderated.

Its sad to see this, given all the investment put into C++/CLI, as well
as the fact that two of my favorite C++ authors, namely Stan Lippman and
Herb Sutter, put a lot of work into this, yet it seems the marketplace
is ignorant of, and maybe even resistent to it.

But I think C++/CLI may wither away, or comprise a very small niche. I
think the best thing to do is either stick with C#/.Net (or vb.net) if
your going to do Windows now and in the future, and for native C++,
either work as a maintence programmer if your on the Windows platform,
or move to a Unix/Linux environment where most of the new and cutting
edge stuff involving C++, as well as C is going on.

-Don Kim
Mar 2 '06
81 4481
We all know who Kang Su Gatlin is, right?

http://msdn.microsoft.com/msdnmag/is...Optimizations/
Here's he clearly spells out the the VC++ compiler for .NET does a lot of
work in optimzations that the JIT is incapable of. Just another article
spelling out that the C++ compiler doesn't just emit IL and that's it.
Thanks,
Shawn
Mar 10 '06 #71
Shawn B. wrote:
Here's he clearly spells out the the VC++ compiler for .NET does a lot of
work in optimzations that the JIT is incapable of. Just another article
spelling out that the C++ compiler doesn't just emit IL and that's it.


Yeah, in the article he flatly claims the following:

"In Visual Studio 2005, the C++ compiler team went to great lengths to
make sure that all of the expertise gained from years of optimizing
native code was applied to managed code optimization. C++ gives you the
flexibility to do fine tuning such as high-performance marshaling that
is not possible with other languages. Moreover, the Visual C++ compiler
generates the best optimized MSIL of any of the .NET languages. The
result is that the best optimized code in .NET comes from the Visual C++
compiler."

Now, this being established, I wish more promotion would be done to make
companies out there knnow about this, so we're not stuck programming all
..Net with C#/VB.NET only.

-Don Kim
Mar 10 '06 #72
> My real world applications proves its possible that the C++/CLI compiler
can produce a better app.

No it does not. I have seen 100's of rigged benchmarks over the years that
"prove" one langauge is faster than another. For all we know, you may have
ineptly chosen your C# compiler switches and so reached a false conclusion
by not comparing like-with-like.

Stephen Howe
Mar 10 '06 #73

"Shawn B." <le****@html.co m> wrote in message
news:Of******** ******@TK2MSFTN GP10.phx.gbl...
| We all know who Kang Su Gatlin is, right?
|
| http://msdn.microsoft.com/msdnmag/is...Optimizations/
|
|
| Here's he clearly spells out the the VC++ compiler for .NET does a lot of
| work in optimzations that the JIT is incapable of. Just another article
| spelling out that the C++ compiler doesn't just emit IL and that's it.
|
|
| Thanks,
| Shawn
|
|

Yes I do, and he is the source of the stuff that's been written by Stephen
Toub in MSDN mag two years ago. The most hilarious part in his story is the
"Whole Program Optimization" chapter, where he gives a sample of what WPO
can do with respect to inlining and constant propagation... but here is the
exact same sample that proves it's not done, but again, that's the danger of
talking about features before they ever get implemented.

// file sub.cpp
// Compile with: cl /LD /clr:safe /O2 sub.cpp
public ref class C
{
public:
int Square(int x)
{
return x*x;
}
};

// File: main.cpp
// Compile with: cl /clr:safe /O2 main.cpp
//
#using <sub.dll>
int main()
{
C^ c = gcnew C;
c->Square(42);
}

And here is the IL ...
// ILDASM output (partly)
....
..maxstack 2
IL_0000: newobj instance void ['sub']C::.ctor()
IL_0005: ldc.i4.s 42
IL_0007: call instance int32 ['sub']C::Square(int32 )
IL_000c: pop
IL_000d: ldc.i4.0
IL_000e: ret
....

where do you see the constant propagation, or the inlining? ...Nowhere, but
rest assured the JIT will take care of this optimization (the constant
proagation and inlining).

I also know his team leader, and his story is somewhat different (sorry
can't tell you anything more because of NDA restriction), it's true they
have done a great job at this level in C++/CLI compared to MC++, but now
they are on par with what C# delivers, or do you think that developers on
the C# or VB team couldn't optimize the IL, provided it was possible? Don't
you think they didn't optimize aggressively and found out that the result
was a performance degradation because they interfered with the JIT.

All this stuff is nothing more than product promotion, something they needed
after the disaster called MC++? But it's strange that now the product is
rleased

Willy.

Mar 10 '06 #74
>> My real world applications proves its possible that the C++/CLI compiler
can produce a better app.

No it does not. I have seen 100's of rigged benchmarks over the years that
"prove" one langauge is faster than another. For all we know, you may have
ineptly chosen your C# compiler switches and so reached a false conclusion
by not comparing like-with-like.


I know far more about how to configure the various switches for C# than I do
the C++ compiler. That said, I'm not an advanced C++ user and I got great
results. Who said anything about "rigging"? I needed more performance,
switched to C++/CLI, and achieved it relatively effortlessly. Everybody
keeps nagging me about various security checks in C#. Everything is
unchecked because the way my virtual CPU is programmed it can either
guarantee there will be no overflows or will check and handle them
appropriately, among many other things.

Just because you guys haven't got the same results doesn't mean I can't. I
don't know what kinds of stuff you benchmark with, but I'm not benchmarking.
I have a simple program that runs in a loop million of times persecond and
makes about 12 function call or more in each loop to do its processing, not
to mentiond the processing overhead of the virtual devices (display,
keyboard, mouse, storage).

What I am saying, is that, I'm not basing my statements on what I read. I'm
basing my statements on my experience. I have not benchmarked anything (for
the sake of doing so), I have not testing numerical crunching (wouldn't know
how to, I have no need), and have not obsorbed what everyone else is saying
as gospel. I rewrote some code in C++/CLI that looks nearly identicle
semantically with its C# predecessor and received major performance boost.
Could be that the overhead of all my function calls are to blame, could be
other things, who knows? When I run in debug mode I get the same if not
worse performance than the C# build. When I run in Release mode with some
C++/CLI compiler settings (that C# doesn't have) I get great performance
boost. Rigged or not, No matter what I do in C# I cannot get similar
performance characteristics .

I'm not really out to "prove" anything, unlike all the MVP's in this forum.
You guys experienced contrary to me, so I must be wrong. Whatever. Grow
up. Learn that there's more to the world than your limited experience and
views. I'm simply saying that things are possible outside of your
experience and limited knowledge of things.

I guess I don't care because now I have the same performance characteristics
I was hoping for and in the end, that's good enough for me, and whether you
believe it or not I don't give a d**n because it isn't your project and your
hobby and your passion. Seems your passion is to live in your box and never
accept other ideas or possibilities. Mine is exploring and growing and
improving my skills and knowledge and learning the best tool for the job.
Thanks,
Shawn
Mar 10 '06 #75
Willy Denoyette [MVP] wrote:

#using <sub.dll>
What is this line for ? Do you really expect other IL code to be inlined
by the C++/CLI compiler ? This compilation/inlining is part of the
..NET runtime, why should this be optimized by the C++/CLI compiler ?
Nobody wrote that global optimization should work over other languages /
external DLL's too.
int main()
{
C^ c = gcnew C;
c->Square(42);
}

And here is the IL ...
// ILDASM output (partly)
...
.maxstack 2
IL_0000: newobj instance void ['sub']C::.ctor()
IL_0005: ldc.i4.s 42
IL_0007: call instance int32 ['sub']C::Square(int32 )
IL_000c: pop
IL_000d: ldc.i4.0
IL_000e: ret
...
And here is mine:

..method assembly static int32 main(string[] args) cil managed
{
// Code size 12 (0xc)
.maxstack 1
IL_0000: ldc.i4 0x6e4
IL_0005: call void [mscorlib]System.Console: :WriteLine(int3 2)
IL_000a: ldc.i4.0
IL_000b: ret
} // end of method 'Global Functions'::mai n

where do you see the constant propagation, or the inlining? ...Nowhere, but
rest assured the JIT will take care of this optimization (the constant
proagation and inlining).
I see it. But not in your example.

All this stuff is nothing more than product promotion, something they needed
[...]

And what is your stuff ?
Willy.


Andre
Mar 12 '06 #76
Willy Denoyette [MVP] wrote:
"Shawn B." <le****@html.co m> wrote in message [...]
However, when calling from managed into a unmanaged accross DLL boundaries ,
the performance of C# PInvoke is better than the C++ interop, the reason for
this is that C++ interop calls GetLastWin32Err or after each call, this
I cannot reproduce this behavior ?! Event if that would be >generally<
true, which I cannot reproduce, the overhead would be accessing a DWORD
value, eventually testing it. This is all what's GetLastError() is
about. IMHO you don't have to call the function. At least Microsoft
shouldn't have to. I think this overhead could be neglected, compared to
the marshaling and other code.
behavior cannot be switched off, while in PInvoke interop you can set a flag
(SetLastErrorCo de=false) to turn this off.

Willy.


Andre
Mar 12 '06 #77

"Andre Kaufmann" <an************ ****@t-online.de> wrote in message
news:OI******** ******@TK2MSFTN GP09.phx.gbl...
| Willy Denoyette [MVP] wrote:
|
| >
| > #using <sub.dll>
|
| What is this line for ?

used to refer to the assembly containing the metadata of the class C, but I
guess you know that.

Do you really expect other IL code to be inlined
| by the C++/CLI compiler ? This compilation/inlining is part of the
| .NET runtime, why should this be optimized by the C++/CLI compiler ?
| Nobody wrote that global optimization should work over other languages /
| external DLL's too.
|

No, I know that they can't inline (existing) IL, and that's exactly my point
and what I tried to prove, but OK, I have two separate assemblies (a DLL and
an EXE) which is somewhat misleading.

Now, I guess your sourcecode files looks like this (please correct me when
I'm wrong):

public ref class C
{
public:
int Square(int x)
{
return x*x;
}
};
#include "sub.h"
int main()
{
C^ c = gcnew C;

int r = c->Square(42);
System::Console ::WriteLine(r);
}

and you compiled it like:
cl /clr:safe /O2 main.cpp
It's true the call will be inlined, but this is one compiland (a sinle
source file) and is not what the article suggest [1]. The header file is
included in the one and only source file and then compiled, right?

< [1] article snip...
The compiler can now perform analysis and optimization across multiple
source files. Without WPO, for example, the compiler can only inline
functions within a single compiland. With WPO, the compiler can inline
functions from any source file in the program.>

now if you make it two compilands (two source files).

// file sub.h, common header
public ref class C
{
public:
int Square(int x);
};

// file sub.h
#include "sub.h"
int C::Square(int x)
{
return x*x;
}

// file main.cpp
#include "sub.h"
int main()
{
C^ c = gcnew C;
int r = c->Square(42);
System::Console ::WriteLine(r);
}

And compile its using:

cl /c /clr:safe /O2 sub.cpp
cl /clr:safe /O2 main.cpp sub.obj

and here is the resulting IL:

..method assembly static int32 main() cil managed
{
..entrypoint
// Code size 19 (0x13)
..maxstack 2
IL_0000: newobj instance void C::.ctor()
IL_0005: ldc.i4.s 42
IL_0007: call instance int32 C::Square(int32 )
IL_000c: call void [mscorlib]System.Console: :WriteLine(int3 2)
IL_0011: ldc.i4.0
IL_0012: ret
} // end of method 'Global Functions'::mai n

You see no inlining any more.

If you have other options, that would inline accross source files, I would
be happy to hear how.
Willy.


Mar 12 '06 #78
>> #using <sub.dll>

What is this line for ? Do you really expect other IL code to be inlined
by the C++/CLI compiler ? This compilation/inlining is part of the .NET
runtime, why should this be optimized by the C++/CLI compiler ?
Nobody wrote that global optimization should work over other languages /
external DLL's too.


I think you're pulling things out of your arse to make an argument. You're
own lack of understanding is causing you to "think" things up and base
you're whole argument on that. It does not inline methods in external
assemblies. It inlines source code that it can see in the *same project*
with some restrictions.

But I thought you would know that, since you're so certain, that despite
what many publications, blogs, and info an MSDN say, the C++/CLI compiler
does not optimize or inline. I don't know what kind of "test" and
"benchmarki ng" you've done, but you certainly haven't done any that resemble
the application I'm working on.
Thanks,
Shawn
Mar 13 '06 #79
Let me just bow down to you. You're right and everyone else is wrong.
Clearly, my performance hasn't nearly doubled by rewriting it in C++/CLI
(similar code symantics, different syntax), I'm just imaging it. Clearly,
everyone that writes on the topic is wrong. Clearly, the C++/CLI compiler
doesn't do any optimzation, despite what MSDN says and quite a few others
who have tested and publicly documented their very interesting findings.

<bows to almighty Willy>
I'm just not worthy.

With Respectful Servitude,
Shawn
Mar 13 '06 #80

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

Similar topics

175
11579
by: Sai Hertz And Control Systems | last post by:
Dear all, Their was a huge rore about MySQL recently for something in java functions now theirs one more http://www.mysql.com/doc/en/News-5.0.x.html Does this concern anyone. What I think is PostgreSQL would have less USP's (Uniqe Selling Points
14
2100
by: ccdetail | last post by:
http://www.tiobe.com/index.htm?tiobe_index Python is the 7th most commonly used language, up from 8th. The only one gaining ground besides VB in the top 10. We're glad, our app is written in python. It's free at http://pnk.com and it is a web timesheet for project accounting
0
9969
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10794
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10896
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10443
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9612
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5830
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6029
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4650
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4251
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.