Click here to Skip to main content
Click here to Skip to main content

A Visit to Redmond - Part 5

By , 23 Oct 2000
 

Introduction

The week before last I popped on over to Redmond to have a chat with the guys at Microsoft on the future of Visual C++, MFC, and the new .NET world. Instead of presenting a point list of what we can expect in the future, I wanted to give you guys a taste of what a visit to Redmond is like from a personal point of view.

Please be aware that this isn't an in-depth technical treatment of .NET - there are a million magazine articles and a ton of stuff on Microsoft's own site to get the basics. The .NET specific stuff presented here will mostly be new information that I wasn't aware of, and that I felt you guys would be interested in, or was simply a vague thought that came to me while slurping through tubs of Ben and Jerry's Fudge Chocolate Disaster ice cream.

A quick Thanks goes to Dundas Software and Microsoft for making this trip possible.

Part 5 - The Compilers

This was going to be a discussion on the libraries (namely MFC, WTL, ATL etc) but I wanted to talk a little bit more about the compiler.

Personally, I would hate to be working on the Visual C++ compiler. The guys who wrote the C# compiler must, I'm sure, wander around to the dark murky depths of the Visual C++ Compiler Developer's cage and lounge around and talk at length on how nice it is to be able to develop a compiler from scratch for a language that is so compiler friendly (well, compared to VC++). Because of the design of the C# language the C# compiler can process up to 3 million lines of code a minute. I'm also guessing there are no C# compliance hassles for the C# compiler team - though once ECMA gets through with the language there is, of course, no gaurantee that non-compliance may sneak in. A standard is merely a standard, and anyone who chooses to implement a compiler is free to change their implementation to whatever suits them (or their market) best.

This is the main problem with the Visual C++ compiler. It's up to something like its 13th incarnation, and each version is building on previous versions, with each new version being backwards compatible with those previous versions. So if someone, way back in version 2.0 made a bad call on a particular feature, then too bad - future generations are stuck with it or are forced to make horrible workarounds to cope with it. Fixing these non-compliance issues is often non-trivial but the guys at Microsoft are at pains to emphasise that when dealing with non-compliance they work at fixing the most used features first. Obviously there are economic (and time) considerations as well. Microsoft has in the past worked towards imposed deadlines (whether or not they ever met those deadlines is another story) and as the deadlines loomed certain features that were deemed, well, optional, were tossed overboard. They no longer want to work this way, and if it means release dates are strung out a little then that's the way it will be. The focus is on quality, not timeliness. Compliance was always on their minds but never as much as some would like, but they do recognise this and are trying to remedy the situation.

Let me digress and pose a question. Templates seem to be an area where religious fanaticism on compliance is particularly rife, but is this really an issue to most developers? Templates can certainly make life easier for a developer, but what about the developer who takes over the project when the original developer leaves? In the face of increased labor shortages is it really wise to be developing apps using specialised techniques for which you or your company will have serious problems finding developers who can maintain your code? Even if you do find such a developer, that person may charge a premium on their specialised services, and/or may cost more in the long run because of the extra time needed to get fully acquainted (and work) with the templatised code. Maybe I'm just a wuss and like taking the easy route to code writing, so I'd be interested in hearing your points of view.

I asked Ronald about the compiler internals and he said that the compiler gets full rewrites only occasionally. There was a rumour that the compiler code was so spaghetti-like in it's internals that no one - no one - wanted to touch the thing. He said it wasn't quite that bad. The last rewrite for the compiler was for Visual C++ version 4. Each version after this has had various revisions, additions, bug fixes, 'feature' additions (you guys know what I'm talking about) and maybe a #pragma or two to keep things interesting. All in all though, the versions of the C++ compiler we've had since Windows 95 development came into vogue are refinements on the original VC4 compiler.

As with each previous incarnation the latest Visual C++ compiler has even undergone further optimisation. Given that this is around the 13th review of the compiler, with each version gaining incremental, and smaller performance increases over the last version, it is amazing that they have tweaked a further 5% performance out of the compiler.

I've already mentioned some of the newest improvements to the Visual C++ compiler: a new crash recovery feature that allows an application to be restored to its state immediately prior to crashing allowing post mortems to be carried out; 'Edit and Continue' has been improved, and there is now public access to the debug info file

On top of these, there is also now a new /GL switch that allows the compiler to perform global optimisations across all files in a project instead of being confined to per-file optimisations. Given varying applications and files there is expected to be a gain of around 5%-10% speed increase in a typical app. Note that this switch is only a 'final-build' option, since it significantly increases compile time.

The compiler also (with the appropriate switch) now inserts buffer overrun checking code into apps that stops the possibility of buffer overrun attacks. This is a major source of attacks in applications such as internet applications and is the subject of many millions of dollars of investment by companies searching for solutions. By simply recompiling your app in VC7 (with said switch) your application will be protected. If you suspect buffer overruns may occur you can simply add your own buffer overrun event handler as a last-ditch 'I've tried everything' resort. Other problems such as the use of uninitialised variables are treated in a similar manner, and you can include your own handler in your code to take care of any uncaught instances of these.

Finally, there are new Processor Packs that you can add to the environment that allow you to target specific processors, such as Pentium III's, processors with 3D Now! etc. Gone are the days of convoluted inline assembly to target these cases. As more processors come out, more processor Packs will be distributed. Any thoughts on why Microsoft would be adding the ability to target different processors so easily? I'm sure they are just looking after us .

Next Instalment...

The Libraries.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Chris Maunder
Founder CodeProject
Canada Canada
Member
Chris is the Co-founder, Administrator, Architect, Chief Editor and Shameless Hack who wrote and runs The Code Project. He's been programming since 1988 while pretending to be, in various guises, an astrophysicist, mathematician, physicist, hydrologist, geomorphologist, defence intelligence researcher and then, when all that got a bit rough on the nerves, a web developer. He is a Microsoft Visual C++ MVP both globally and for Canada locally.
 
His programming experience includes C/C++, C#, SQL, MFC, ASP, ASP.NET, and far, far too much FORTRAN. He has worked on PocketPCs, AIX mainframes, Sun workstations, and a CRAY YMP C90 behemoth but finds notebooks take up less desk space.
 
He dodges, he weaves, and he never gets enough sleep. He is kind to small animals.
 
Chris was born and bred in Australia but splits his time between Toronto and Melbourne, depending on the weather. For relaxation he is into road cycling, snowboarding, rock climbing, and storm chasing.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralRe: Template guys are so tensesussWilliam E. Kempf25 Oct '00 - 4:15 
I won't bite on the flame bait. However...
 
a) I'm not a template guy. I'm a C++ guy.
b) I'm not tense. I am frustrated, and with good reason.
 
Do you know the number of things available to us that we can't use because of non-compliance with the language? There are a lot of extremely useful packages that either can't be ported to VC, or must be crippled in order to be used by VC. Even the STL provided with the compiler has had to cripple a LOT of things because of non-compliance. VC7 has fixed enough things that through herculean efforts the STL can be made to mostly work, but there are still numerous packages that simply won't. Want a list?
 
tuples (think of pairs with more than 2 parameters)
lambda/expression templates
slots (think COM events on steroids)
call traits (solves the reference to reference problem)
 
Even simple things like Regexp++ and BGL (graph library) have had to "dummy down" the implementation for VC++.
 
This isn't a political tirade. If it were you would not likely find me speaking out against MS. After all, I make a living off of their technology. I know who butters my bread. No, this is a very legitimate complaint about the compiler. There is no excuse (political, business or market driven) for a non-compliant compiler 3 years after the release of the standard
GeneralWhy I need better template supportsussJonathan Gilligan24 Oct '00 - 13:26 

I stick with MS tools and Windows and recommend them to others because I find I am most productive working with them. However, I get really frustrated about the lack of concern for templates, namespaces, etc. on MS's part.

I write a lot of heavily numeric code. I use C++ because it makes it easier to write and maintain my code than working in FORTRAN, but there are some real performance hits. Some libraries such as Blitz++ claim to be able to remove a lot of the performance hits by making fancy use of templates, including a LOT of partial specialization. Many compilers such as GCC, KAI C++, Metrowerks Codewarrior, Borland C++ Builder, and IBM Visual Age C++ can work with Blitz++, but Visual C++ cannot.

Let me reiterate with emphasis: Templates do not only let you do more with less code. They can also seriously speed up your code at runtime. Anyone working with large arrays (image processing, DSP, scientific and engineering computing, statistical analysis) and who cares about run-time performance should be pushing hard for better template support.

I don't pretend to know all the ins and outs of partial template specialization, but the problem for me is that there are major libraries that would potentially help my productivity and the performance of my code, but I can't use them because of MS's lack of attention to standards compliance.

I would also note that there is a bit of a chicken-and-egg problem here. The way most programmers learn about language features is to try them out and play with them. There is a good book about templates and generic programming (Generic Programming and the Stl : Using and Extending the C++ Standard Template Library by Matthew H. Austern (Addison-Wesley, 1998)), but a poor MSVC developer can't play with the new ideas from the book and learn about where they would and would not be useful because MSVC won't compile the code.

Thus, as long as MS won't support many advanced template features, developers who need these features will buy other compilers and those who stick with MSVC are likely to be unfamiliar with the advantages they would gain from features that MS does not support.

To make matters worse, MFC is actively hostile to many pieces of best-practices C++ coding. As we get into more and more complicated designs, use of C++ namespaces becomes essential to prevent collisions between different libraries' namespaces. However I challenge anyone to derive a class from CObject within a namespace and then use any of the basic MFC features such as DECLARE_xxx/IMPLEMENT_xxx. Similarly deriving abstract classes or template classes from CObject breaks most of the nice functionality that MS put in for simple classes. The library's hostility towards advanced C++ features is pushing me away from MFC in more and more of my coding, and I am sorry because there are many nice things about that library if MS were to maintain it more actively.

GeneralRe: Why I need better template supportsussTwain Summerset24 Oct '00 - 21:38 
I would like to second the comments made by Jonathan. I write engineering and scientific analysis programs for aerospace trajectory applications. The applications tend to make heavy use of numerical analysis data structures and the like.
 
I have been investigating porting FORTRAN codes into C++ so that they can be coupled with a Windows GUI and maintained with one complier on a microcomputer. Some of the FORTRAN is heavily numerical analysis based and having seen the claims made by Blitz++, I am eager to get highly efficient version of the code working. The problem, is as Jonathan points out, Visual C++ does not support the template features needed to make it easy (possible??) to use Blitz++.
 
I wonder if Microsoft really ever polls the engineering and scientific computing communities to discover their issues? Not every developer is focusing on business and e-commerce applications.
 
On another note about MFC, I wanted to use multiple inheritance and templates on an object I wanted to "serialize" using MFC's CObject and serialization API. I found that I could not!! I have had it with MFC and hope Microsoft will embrace WTL and move MFC features to WTL, rearchitecting along the way. Any chance an ATL/WTL version of the serialization API might make it into the next C++ compiler
GeneralWTLsussChristian Andersen25 Oct '00 - 2:41 
The last I've heard about WTL is that Microsoft has abandoned it as a mistake. So, I guess, there is'nt much hope that it will become the next MFC.
 
Christian Anderse
GeneralRe: C'mon Chris, you're better than that!sussWilliam E. Kempf25 Oct '00 - 4:05 
Maybe I did read more into what you wrote than what you meant. However, I still find it baffling that anyone would except anything less than full compliance from any compiler released from this point on by any company. It sure seemed to be that you were making excuses for them claiming that most programmers don't want the features that are missing in any event.
 
As for the question, since it's not rhetorical, yes it is a very big issue. So long as you're only using the compiler to write GUI MFC applications this is a non-issue to you. However, even ATL coders have to be feeling the crunch here, and anyone using the compiler to write server side components (especially if such components need to be portable) is vastly concerned about such issues. Further, even if you only do GUI coding, if you use the STL to any extent at all you should care very much about this issue.
 
BTW, your last paragraph misses the mark! I'm not talking about "features that MS's customers need". I'm talking about language compliance. You can leave a "feature" that's required by the language out just because you believe your customers don't want it
GeneralExample does not convince me.sussSito Dekker24 Oct '00 - 10:53 
Your example does not convince me. It's elegant, ok, but not more.
- The gain in understandability and number of lines relative to writing the print statement explicitly in a function is marginal.
- If you typedef the iterator for the vector, which you would do for every serious iterable type anyway, then the example rewritten without the for_each is at least as clear (and everyone understands it).
- If you want to do even a little bit more of work within the loop than in this trivial example, then the notation gets hopeless very quickly.
 
I've read the book "Generic Programming and the STL" and I like the concept of generic programming. However, I see no use for the advanced features in day-to-day C++ programming. Basic lists, vectors and iterators: they are great and I use them all the time. The advanced features: nice but I have yet to discover a killer app for them. The real problems of programming seem to lye elsewhere.
 
What irritates me is that "intellisense" does not work with iterators (members do not show up) and the noisy error messages if something is wrong with template-based code. I certainly hope these problems are fixed, they are of far higher priority to me than partial template specialisations.
 
So I agree with Chris. I don't think he or Microsoft is insulting us. As far as I'm concerned, they made the right kind of prioritization
GeneralRe: Example does not convince me.sussChris Maunder24 Oct '00 - 11:35 
One point which I haven't mentioned yet is the improvement in error messages for templates in the new compiler. The error messages are far less "noisy" and the variable types will be resolved back to more intelligent names, instead of the mess of angle brackets that is currently offered.
 
cheers,
Chris Maunde
GeneralRe: Example does not convince me.sussWalter Sullivan24 Oct '00 - 13:46 
We'll also point you at the instantiation with the compiler error and not the base template when appropriate.
 
Symbol names in the debugger and other places can be longer than 256 chars which is also a problem in our tools that was aggrivated by increasing template usage.
 
Later,
Walter Sullivan
Program Manager ATL/MF
GeneralRe: Example does not convince me.sussWilliam E. Kempf26 Oct '00 - 3:36 
> Your example does not convince me. It's elegant, ok, but not more.
 
It was the simplest of examples. I could give plenty more, but instead I'll
address your points here.
 
> - The gain in understandability and number of lines relative to writing the
print statement explicitly in a function is marginal.
 
It's not marginal when the functionality becomes more complex.
 
> - If you typedef the iterator for the vector, which you would do for every
serious iterable type anyway, then the example rewritten without the for_each is
at least as clear (and everyone understands it).
 
I'll almost buy this. However, for_each is the simplest of algorithms. An
example using merge with a complicated predicate would illustrate the
differences better. Explicitly writing this code with out the algorithm may be
understandable, but it's a lot of code to write which can lead to logic errors.
Sorry, I won't do with out algorithms even if I have to do without lambda
functions.
 
> - If you want to do even a little bit more of work within the loop than in this
trivial example, then the notation gets hopeless very quickly.
 
Evidence? I can show you very complex lambda expressions that are easier to
write and comprehend then the equivalent hand coded for loop. Lambda
expressions are similar enough to standard C++ constructs to be immediately
intuitive... more so than hand coded functors and simpler than hand coded loops.
 
> I've read the book "Generic Programming and the STL" and I like the concept of
generic programming. However, I see no use for the advanced features in
day-to-day C++ programming. Basic lists, vectors and iterators: they are great
and I use them all the time. The advanced features: nice but I have yet to
discover a killer app for them. The real problems of programming seem to lye
elsewhere.
 
You seem to lump algorithms into the advanced category. They don't fit there,
and they have every day applicability.
 
> What irritates me is that "intellisense" does not work with iterators (members
do not show up) and the noisy error messages if something is wrong with
template-based code. I certainly hope these problems are fixed, they are of far
higher priority to me than partial template specialisations.
 
Most iterators don't have members, per se, only operators. Further, a lot of
iterators are nothing but pointers so there is nothing for a debugger to show
you. Error messages are a concern, but compiler vendors (including MS in VC7)
are addressing this, and there are coding techniques that can be employed to
reduce the "noise" and produce understandable error messages. As for
priority... our priorities differ greatly... and the numbers that fall into the
two camps is near 50/50.
 
> So I agree with Chris. I don't think he or Microsoft is insulting us. As far as
I'm concerned, they made the right kind of prioritization.
 
What was insulting wasn't the prioritization (though that's frustrating for a
very large segment of coders), but the reason given for the prioritization.

GeneralBoost?susspUnk24 Oct '00 - 13:10 
What's "Boost"?
 
Link? Reference? Author name?
 
TIA

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 24 Oct 2000
Article Copyright 2000 by Chris Maunder
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid