c++ .net
-
Anna-Jayne Metcalfe wrote: mix and match managed and unmanaged code in the same project - and indeed in the same file. I thought you could do this with C# by calling/importing in un managed functions? ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF!
C# can import external modules written in C or C++. With MC++ you can actually write both managed and native code in the same module.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
-
dave2k wrote: so then what is the point in using c++ with it's added complexities (admitedly not as comlpex as unmanagaed c++) Managed C++ adds, no multiplies, the complexities of C++ and C#. I don't see a point using it besides for re-using code that is now deemed 'legacy' by Microsoft.
CP Visitor wrote: Managed C++ adds, no multiplies, the complexities of C++ and C#. Have you ever actually used Managed C++?
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
-
Anna-Jayne Metcalfe wrote: mix and match managed and unmanaged code in the same project - and indeed in the same file. I thought you could do this with C# by calling/importing in un managed functions? ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF!
You can, but not in the same file. i.e. a C++ file can switch between managed and unmanaged code at pretty much any point - even within a single function. That allows easier interop between CLR and native code than is possible with other languages - even C# can't do this. Take a look at #pragma managed/unmanaged[^]. It's no mistake that Microsoft have been calling C++ the "most powerful of the .net languages". :cool: Anna :rose: Riverblade Ltd - Software Consultancy Services Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.
-
CP Visitor wrote: Managed C++ adds, no multiplies, the complexities of C++ and C#. Have you ever actually used Managed C++?
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
Nemanja Trifunovic wrote: Have you ever actually used Managed C++? No, it's too complex for me :-D
-
CP Visitor wrote: Managed C++ adds, no multiplies, the complexities of C++ and C#. Have you ever actually used Managed C++?
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
I've been playing around with the VC++ 2005 Express beta, the new syntax is much better. Also, it has cool things like RAII with ref classes, separate set and get methods for properties with the ability to have different access modifiers and the for each statement. But I get this feeling that it is just C++ catching up with C#. Also, everytime I use a managed C++ construct, I feel I'm losing my grip on pure C++ (especially with C++0x coming up). Regards Senthil _____________________________ My Blog | My Articles | WinMacro
-
Nemanja Trifunovic wrote: Have you ever actually used Managed C++? No, it's too complex for me :-D
:-D It is not that complex, and the new version (C++/CLI) is really simpler to use than C#. The problems I had with (original) MC++ were caused by bugs in the implementation (like virtual bool one), not "complexity".
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
-
I've been playing around with the VC++ 2005 Express beta, the new syntax is much better. Also, it has cool things like RAII with ref classes, separate set and get methods for properties with the ability to have different access modifiers and the for each statement. But I get this feeling that it is just C++ catching up with C#. Also, everytime I use a managed C++ construct, I feel I'm losing my grip on pure C++ (especially with C++0x coming up). Regards Senthil _____________________________ My Blog | My Articles | WinMacro
S. Senthil Kumar wrote: Also, it has cool things like RAII with ref classes, separate set and get methods for properties with the ability to have different access modifiers and the for each statement. The thing I like best about C++/CLI is the way compiler automatically implements the Dispose Pattern[^] :cool: . With all other languages, the burden is on developers.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
-
With C++, you can mix and match managed and unmanaged code in the same project - and indeed in the same file. No other language offers that capability. Anna :rose: Riverblade Ltd - Software Consultancy Services Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.
can't you do the same in C# using the "unsafe" keyword?
-
can't you do the same in C# using the "unsafe" keyword?
No. The unsafe keyword symbolizes a class, method, or block of code that uses pointers. It's still managed code (it's being "managed" by the .NET Common Language Runtime (CLR)), however, it is unsafe, meaning it's unverifiable, non-CLS compliant, and can't be run in a partial trust scenario, such as over the internet via a C# 'applet'. Unmanaged code is code that doesn't get touched by the .NET CLR. As an example, a C++/CLI app could use MFC's CString, show and MFC dialog, dabble on a low, unmanaged level with some COM component, then return the CString as a .Net System::String object. C#'s unsafe can only do unsafe memory manipulation, such as using pointers or native stack allocation.
Tech, life, family, faith: Give me a visit. I'm currently blogging about: Homosexuality in Christianity Judah Himango
-
CP Visitor wrote: Managed C++ adds, no multiplies, the complexities of C++ and C#. Have you ever actually used Managed C++?
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
I've been programming for 25 years, and programming C/C++ for 15 years. I don't feel that my code needs to be "managed". ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
-
I've been programming for 25 years, and programming C/C++ for 15 years. I don't feel that my code needs to be "managed". ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Doesn't have to be, no one's forcing you. If you want memory management or access to the framework for even part of your code, it's there if you want it.
Tech, life, family, faith: Give me a visit. I'm currently blogging about: Homosexuality in Christianity Judah Himango
-
No. The unsafe keyword symbolizes a class, method, or block of code that uses pointers. It's still managed code (it's being "managed" by the .NET Common Language Runtime (CLR)), however, it is unsafe, meaning it's unverifiable, non-CLS compliant, and can't be run in a partial trust scenario, such as over the internet via a C# 'applet'. Unmanaged code is code that doesn't get touched by the .NET CLR. As an example, a C++/CLI app could use MFC's CString, show and MFC dialog, dabble on a low, unmanaged level with some COM component, then return the CString as a .Net System::String object. C#'s unsafe can only do unsafe memory manipulation, such as using pointers or native stack allocation.
Tech, life, family, faith: Give me a visit. I'm currently blogging about: Homosexuality in Christianity Judah Himango
You beat me to it. Good explanation. :) Anna :rose: Riverblade Ltd - Software Consultancy Services Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.
-
Anna-Jayne Metcalfe wrote: mix and match managed and unmanaged code in the same project - and indeed in the same file. I thought you could do this with C# by calling/importing in un managed functions? ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF!
With other .NET languages you have to specifically use something like COM interop or PInvoke. With C++, it's completely transparent to you. As an example, I can create an MFC application that uses any .NET class and looking at the code, you can't seen any difference - hence the term of the underlying mechanism - IJW (It Just Works) Cheers, Tom Archer - Visual C++ MVP Archer Consulting Group "So look up ahead at times to come, despair is not for us. We have a world and more to see, while this remains behind." - James N. Rowe
-
what's this all about then? if all the .net languages compile down to the same intermediate language, i assume that a similar program written in c++ .net and lets say c# runs at the same speed? so then what is the point in using c++ with it's added complexities (admitedly not as comlpex as unmanagaed c++) to keep the older developers happy?
It has nothing to do with keping "older developers happy". It's about keeping large customers happy. If you're running a company with millions spent on training and development, you don't want to have to retrain your developers and then have them redo everything just because Microsoft has a new language du jour. Porting most of the "mainstream languages" to .NET allows companies to continue using current employees and not having to rewrite their systems. Specifically, Managed C++ allows a company to move "piece-meal" over to .NET by rewriting small bits at a time or simply by writing the new bits with the .NET BCL. Cheers, Tom Archer - Visual C++ MVP Archer Consulting Group "So look up ahead at times to come, despair is not for us. We have a world and more to see, while this remains behind." - James N. Rowe
-
I've been programming for 25 years, and programming C/C++ for 15 years. I don't feel that my code needs to be "managed". ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
John Simmons / outlaw programmer wrote: I've been programming for 25 years, and programming C/C++ for 15 years. I don't feel that my code needs to be "managed". I have been programming for only 21 years, and C/C++ for 11 years, but I feel the same. However, if I am required to write managed code, better give me a good programming language. I want power, not "simplicity".
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
-
John Simmons / outlaw programmer wrote: I've been programming for 25 years, and programming C/C++ for 15 years. I don't feel that my code needs to be "managed". I have been programming for only 21 years, and C/C++ for 11 years, but I feel the same. However, if I am required to write managed code, better give me a good programming language. I want power, not "simplicity".
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
I want power, not "simplicity". I want power and simplicity. Power without simplicity: being able to skim a dollar off the checking accounts of every person in the world, provided you remember the checking account numbers in your head. Power with simplicity: having every checking account number in your database. :)
Tech, life, family, faith: Give me a visit. I'm currently blogging about: Homosexuality in Christianity Judah Himango
-
if all the .net languages compile down to the same intermediate language, i assume that a similar program written in c++ .net and lets say c# runs at the same speed? .NET languages all compile down to an intermediate language. However, each compiler emits different IL codes. This was demonstrated a few months ago when a J#, VB.NET, and C# app compiled code that was functionally identical, however, C#'s optimizing compiler was able to produce a more highly optimized, and therefore faster, resulting bytecodes. The new C++/CLI, as it's referred to, produces a highly compact and optimized IL. There was an article on MSDN recently regarding this, along with benchmarks. Furthermore, the new C++ compiler provides Bottom-Up, Top Down analysis for both managed and unmanaged code. The long-awaited Profile Guided Optimizations (POGO) part of the 2005 compiler also works on managed and unmanaged code. And of course, C++/CLI is the only .NET language that can mix managed and native code, allowing you to reuse existing native codebases and still take advanatage of the .NET framework class library if you need. Finally, C++/CLI is the only .NET language that will be able to use C++ templates or CLR generics, which is a powerful feature and makes using managed code more natural to C++ developers. Some good articles on this here[^] and here[^].
Tech, life, family, faith: Give me a visit. I'm currently blogging about: Homosexuality in Christianity Judah Himango
Judah Himango wrote: However, each compiler emits different IL codes. This was demonstrated a few months ago when ... nice reply (you already got my 5), but do you really feel a demonstration is: 1. required 2. possible (I've read a lot of articles, some of them on CP, discussing how C# and VB.NET evolve towards the generation of identical code) OGR
-
what's this all about then? if all the .net languages compile down to the same intermediate language, i assume that a similar program written in c++ .net and lets say c# runs at the same speed? so then what is the point in using c++ with it's added complexities (admitedly not as comlpex as unmanagaed c++) to keep the older developers happy?
You're missing the point here. The CPU only executes assembly code, why would you need anything else according to your argument? C++ is not only not dead (even Fortran and Cobol are not dead), but still evolving. C++.net is (among other things) a natural link between a very powerful language (the large number of drawbacks do not change this) and the latest "global" framework. The fact that you have a nice transition to new languages and tools for people with tons of experience (that is one of the perks of being "old") while keeping a large base of potential maintainers of legacy code are just a few of the many extras. OGR
-
No. The unsafe keyword symbolizes a class, method, or block of code that uses pointers. It's still managed code (it's being "managed" by the .NET Common Language Runtime (CLR)), however, it is unsafe, meaning it's unverifiable, non-CLS compliant, and can't be run in a partial trust scenario, such as over the internet via a C# 'applet'. Unmanaged code is code that doesn't get touched by the .NET CLR. As an example, a C++/CLI app could use MFC's CString, show and MFC dialog, dabble on a low, unmanaged level with some COM component, then return the CString as a .Net System::String object. C#'s unsafe can only do unsafe memory manipulation, such as using pointers or native stack allocation.
Tech, life, family, faith: Give me a visit. I'm currently blogging about: Homosexuality in Christianity Judah Himango
Judah Himango wrote: C# 'applet'. This made me smile but a good explanation. Einstein: "Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe." My Articles