Export (0) Print
Expand All
Abortable Thread Pool
The Analytic Hierarchy Process
API Test Automation in .NET
Asynchronous HttpWebRequests, Interface Implementation, and More
Bad Code? FxCop to the Rescue
Basics of .NET Internationalization
Behind the Scenes: Discover the Design Patterns You're Already Using in the .NET Framework
BigInteger, GetFiles, and More
Binary Serialization of DataSets
Building Voice User Interfaces
Can't Commit?: Volatile Resource Managers in .NET Bring Transactions to the Common Type
CLR Inside Out: Base Class Library Performance Tips and Tricks
CLR Inside Out: Ensuring .NET Framework 2.0 Compatibility
CLR Inside Out: Extending System.Diagnostics
CLR Profiler: No Code Can Hide from the Profiling API in the .NET Framework 2.0
Concurrent Affairs: Build a Richer Thread Synchronization Lock
Custom Cultures: Extend Your Code's Global Reach With New Features In The .NET Framework 2.0
Cutting Edge: Collections and Data Binding
Const in C#, Exception Filters, IWin32Window, and More
Creating a Custom Metrics Tool
DataGridView
DataSets vs. Collections
Determining .NET Assembly and Method References
Experimenting with F#
File Copy Progress, Custom Thread Pools
Finalizers, Assembly Names, MethodInfo, and More
Got Directory Services?: New Ways to Manage Active Directory using the .NET Framework 2.0
High Availability: Keep Your Code Running with the Reliability Features of the .NET Framework
How Microsoft Uses Reflection
ICustomTypeDescriptor, Part 2
ICustomTypeDescriptor, Part 1
Iterating NTFS Streams
JIT and Run: Drill Into .NET Framework Internals to See How the CLR Creates Runtime Objects
Lightweight UI Test Automation with .NET
Low-Level UI Test Automation
Make Your Apps Fly with the New Enterprise Performance Tool
Managed Spy: Deliver The Power Of Spy++ To Windows Forms With Our New Tool
Memory Models: Understand the Impact of Low-Lock Techniques in Multithreaded Apps
Microsoft Java Virtual Machine Update
Microsoft .NET Framework Delivers the Platform for an Integrated, Service-Oriented Web, Part 2
Mini Dump Snapshots and the New SOS
Mutant Power: Create A Simple Mutation Testing System With The .NET Framework
NamedGZipStream, Covariance and Contravariance
.NET Internationalization Utilities
.NET Profiling: Write Profilers With Ease Using High-Level Wrapper Classes
No More Hangs: Advanced Techniques To Avoid And Detect Deadlocks In .NET Apps
The Perfect Host: Create and Host Custom Designers with the .NET Framework 2.0
Phoenix Rising
Scheme Is Love
Security Enhancements in the .NET Framework 2.0
Sepia Tone, StringLogicalComparer, and More
Software Testing Paradoxes
Stay Alert: Use Managed Code To Generate A Secure Audit Trail
Stream Decorator, Single-Instance Apps
StringStream, Methods with Timeouts
SUPERASSERT Goes .NET
Tailor Your Application by Building a Custom Forms Designer with .NET
Test Harness Design Patterns
ThreadPoolPriority, and MethodImplAttribute
ThreadPoolWait and HandleLeakTracker
Three Vital FXCop Rules
A Tidal Wave of Change
To Confirm is Useless, to Undo Divine
Touch All the Bases: Give Your .NET App Brains and Brawn with the Intelligence of Neural Networks
Transactions for Memory
Trustworthy Software
Tune in to Channel 9
UDP Delivers: Take Total Control Of Your Networking With .NET and UDP
UI on the Fly: Use the .NET Framework to Generate and Execute Custom Controls at Run Time
Unexpected Errors in Managed Applications
Unhandled Exceptions and Tracing in the .NET Framework 2.0
Using Combinations to Improve Your Software Test Case Generation
Wandering Code: Write Mobile Agents In .NET To Roam And Interact On Your Network
What Makes Good Code Good?
XML Comments, Late-bound COM, and More
Expand Minimize
3 out of 7 rated this helpful - Rate this topic

Dr. GUI on Visual C++ .NET

 

Microsoft Corporation

February 2002

Introduction and How to Get It
The "C++ Futures" Talk: Saving the Best for Last
C/C++: World's Most Popular Primary Language
New in Visual C++ .NET
Stan Lippman: "Ensnared by the .NET"
Conclusions

Introduction and How to Get It

Microsoft® Visual C++® .NET is finally here! Yea!

It's available as a download with Microsoft Visual Studio® .NET to MSDN Professional, Enterprise, and Universal subscribers at http://msdn.microsoft.com/subscriptions/resources/subdwnld.asp. If you're not a subscriber, you can find out how to buy it from http://msdn.microsoft.com/visualc/.

If you just want the Visual C++ .NET compiler without the IDE, it's available for free with the Microsoft .NET Framework SDK at http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asp)

Now that Visual C++ .NET is here, you might be wondering (if you're a C++ programmer):

  • What's new?
  • What's next?
  • Does Microsoft care about C++ any more, or does it think the future is in C#?

Dr. GUI's been wondering the same things—and he has a few answers for you. The answer to the last question—that Microsoft cares a great deal about C++ and C++ standards and knows that C++ has an important place in .NET—may surprise you if all you've heard is the constant promotion of C# and Microsoft Visual Basic® .NET.

The "C++ Futures" Talk: Saving the Best for Last

The good doctor had the chance in October to, like many of you, attend PDC 2001. For Dr. GUI, as a C++ kinda guy (who likes C# and does some Visual Basic, truth be told), the most exciting thing about PDC was not the Bill Gates keynote. Nor was it Eric Rudder talking about his new role heading up the Microsoft Developer and Platform Evangelism group. (Although both of those were good.) Heck, it wasn't even the Rick Rashid keynote about all the cool things Microsoft Research (http://research.microsoft.com/) is doing. (Although that was great!) Rather, the folks who scheduled the conference saved the best for last: The very last session of the conference, on Friday afternoon, was called "C++ Futures." Nick Hodapp, Visual C++ Product Manager, did a great job of explaining the new features of Visual C++ .NET and showing what a cool future C++ has, both in the native code and in the .NET worlds!

C/C++: World's Most Popular Primary Language

For a long time now, C and C++ have been the languages that are most commonly used for "heavy-duty" development—even for the .NET Framework (although most .NET development is in C# or Visual Basic .NET). There are a number of things you can do in C++ and IL (the assembly language of .NET) that you can't do even in C#.

But Dr. GUI didn't know until this presentation that the 2001 IDC Professional Developer Model research report found that C/C++ is the language used worldwide by more developers than any other. More than Visual Basic. More than Brand J. More than anything. The good doctor knew he was in good company as a C++ programmer, but he didn't realize he was in such company plentiful company—about three million developers worldwide!

New in Visual C++ .NET

Nick then talked about the new features in Visual C++ .NET (a.k.a. Visual C++ 7.0). First off, Visual C++ .NET supports creating Microsoft .NET Framework applications. We'll talk more about that later.

For Native (Win32/64) Code

For non-managed (native, or Microsoft Win32®/64™) code, Visual C++ has a bunch of new features. First off, it's unique among Visual Studio .NET languages in that it's compatible with the previous version, meaning that you can easily port most programs to the Visual C++ .NET and take advantage of the new compiler and link features.

It's also unique in that it can produce native code: All of the other Visual Studio .NET languages produce managed applications only. So if you want to produce standard Win32/64 executables with Visual Studio .NET, you have one choice: Visual C++.

And Visual C++ is better than before. First, the compiler's compliance to the American National Standards Institute (ANSI) standard for C++ is better than before. Whole-program optimization is now supported (in addition to source file-by-source file), meaning that optimizations such as register allocation and inlining can be applied even when a function in another source file is called. The results in speed and size can be incredible, especially with accessor functions. And there are new intrinsic functions that allow you to take advantage of MMX, SSE, and SSE2 instructions for faster numeric processing on processors that support those instruction-set extensions. Finally, runtime checks (such as for stack overflow, numeric overflow when assigning to a smaller type, buffer overruns, and use of uninitialized variables) can be included with compiler options.

There have also been improvements in all of the libraries (see Visual C++ .NET: What's New for MFC Developers? in the September 2001 issue of MSDN News) and one new library: the ATL Server template library, which allows you to write super-fast Web server components. (These are harder to write than ASP or Microsoft ASP.NET, but faster!)

Finally, Visual C++ supports attributed programming. This is different from attributes in the .NET Framework, which only allow you to associate attributes (and metadata) with parts of your code. Attributed programming in Visual C++ does that, but it can also do much more.

Visual C++-attributed programming also allows you to use attributes that affect how the compiler generates your code (and metadata) and even to define attributes that inject code and metadata into your programs—for instance, to give you custom function entry or exit sequences, or to associate a GUID with a function. This is very common and useful for COM and COM+/MTS programming.

In short, Visual C++ .NET has a lot of great new features to help you produce the fastest, most powerful native (unmanaged) programs ever.

But wait … there's more!

For Managed (.NET Framework) Code

Visual C++ .NET allows you to produce managed code, too. It even allows you to mix managed and unmanaged (native) code in the same assembly, and to use a mixture of managed and unmanaged objects, thereby allowing you to migrate code piece by piece and still maintain good efficiency. Finally, Visual C++ .NET produces the best-optimized IL code of any Visual Studio .NET compiler.

In addition, there are some features of the .NET Framework that are only exposed by Visual C++ .NET and not by any other Visual Studio .NET language. For instance, you can control when values are boxed and unboxed in Visual C++ .NET.

This means that Visual C++ will be able to produce the meanest, leanest .NET Framework applications—and will be able to switch to unmanaged code as necessary.

The price you pay

But this power comes at a price: First, as you know, C++ is somewhat more complicated than, say, C# or Visual Basic .NET. More importantly, Visual C++ .NET code cannot be made verifiably type-safe. This means that Visual C++ .NET modules must be trusted, so many of the scenarios where you download code over the Internet from a source you don't totally trust won't work with code generated by this version of Visual C++ .NET. (Allowing Visual C++ .NET to produce verifiably type-safe code is a top priority for a future release.)

And even better in the future

As nice as Visual C++ .NET is, Microsoft has its sights targeted on an even better C++ implementation going forward.Microsoft will focus on creating the best C++ on the market, with second-to-none ANSI conformance, .NET Platform support, interop, and native performance. In short, it will clearly be the best language for systems-level programming, regardless of whether you use .NET, and will be the most highly standards-conformant compiler available.

Stan Lippman: "Ensnared by the .NET"

The session continued with Nick making a stunning announcement: Microsoft just the week before hired Stan Lippman as an architect for its C++ product. That's the Stan Lippman, the author of The C++ Primer, the book from which many of us learned C++ in the first (or second) place. He then introduced Stan and asked him to speak. (For the Code Project's interview with Stan, see http://www.codeproject.com/interview/stanlippman14nov2001.asp.)

One might ask, "What in the world is Stan Lippman, who'd worked with Bjarne Stroustrup (creator of the C++ language), at AT&T Bell Labs doing working for Microsoft?" As Stan puts it, "I fell in love with the .NET platform."

Stan talked a bit about how he evaluates a new platform. He looks for two things: The new platform should do everything he knows how to do on other platforms (and not be any harder), and be able to do things you couldn't do otherwise.

A few months ago, Microsoft invited Stan to discuss job possibilities. Since Stan had just finished a book on C# (The C# Primer, to be published by Addison Wesley), he assumed that Microsoft would want him to work on C# because he figured Microsoft didn't have any future commitment to C++. But, as Stan said, "It turns out that C++ is central and key to .NET."

And with three million developers worldwide, why not? In addition, C++ occupies an interesting niche in programming languages: It combines very high-level abstractions, such as object-oriented programming, and extremely powerful templates with very low-level capabilities, such as bit manipulations, direct access to memory by address, and casting. In other words, you can do almost anything you can do in assembly language in C++, but you can also build incredibly rich and sophisticated abstractions in C++ programs. When Dr. GUI taught C++, he referred to it as "object-oriented assembly language." The good doctor meant two things by that: first, as an object-oriented language, you have a tremendous amount of control over all sorts of stuff, including how inheritance is done (for instance, whether functions and base classes are virtual or not); and second, C++ is a language that combines the power of assembly-level programming with the power of rich abstractions, including object orientation. That's a good combination, provided you're willing to take the effort to learn C++ well.

So C++ is always about choices—and the Managed Extensions to C++ give you even more choices. Use the C++ object model, or the .NET object model—or both. Use native code or managed code—or both.

Stan talked about some of the trade-offs likely to be involved in making Visual C++ better in the future, making the point that by picking what you work on carefully, you can focus on what's really most valuable for users. For him, that means two things: making C++ a first-class .NET language and improving standards compliance so that programmers can try out language features, confident that Visual C++ supports them. Especially important is the work that needs to be done to the template implementation so that Visual C++ users can use advanced template facilities to take advantage of the power of ANSI/ISO Standard C++.

He closed by saying that it was good to be home again—back with language development, back with C++, and moving forward with .NET.

Conclusions

If you're using Visual C++ now, you're in good company, along with about three million C/C++ programmers worldwide.

Visual C++ .NET has many improvements over version 6.0, so it's a very worthwhile upgrade for your Win32 applications. Upgrading can give you, with minimal changes to your code, smaller, faster executables with new optimizations, including whole-program optimization. New library features make programming easier. And the new ATL Server library helps you write lightning-fast server components for those times when server performance is crucial.

Visual C++ .NET also allows you to program for the .NET Framework—and even to move your programs to .NET bit by bit with mixed managed and unmanaged code and data. And it provides access to features no other language can get at.

Finally, with the upcoming changes, it's clear that for Visual C++ .NET, the best is yet to come. Dr. GUI is really looking forward to it!

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.