Você está na página 1de 21

VISUAL C++ 2008

VC++ 9.0

Fabio Galuppo
Software Engineer (Im a programmer!) Visual C++ MVP C/C++ Brasil Community Member

Whats new in Visual C++ 2008


IDE & Controls
Dialog boxes that are created in ATL, MFC, and Win32

applications now comply with the Windows Vista style guidelines The ATL Project wizard now has an option to register components for all users Writing to the registry can be redirected The Class Designer now has limited support for native C++ code

http://msdn2.microsoft.com/en-us/library/bb384632.aspx

Whats new in Visual C++ 2008


IDE & Controls

http://msdn2.microsoft.com/en-us/magazine/cc163402.aspx

Whats new in Visual C++ 2008


Libraries
STL/CLR Library Visual C++ now includes the STL/CLR Library. MFC Library Windows Vista supports Common Controls. Over 150 methods in 18 new or existing classes have been added to support features in Windows Vista, or to improve functionality in current MFC classes. C++ Support Library C++ introduces the marshaling library. ATL Server ATL Server is released as a shared source project.

http://msdn2.microsoft.com/en-us/library/bb384632.aspx

Whats new in Visual C++ 2008


Compiler

The compiler supports managed incremental builds. The compiler supports Intel Core 2 microarchitecture Intrinsics support newer AMD and Intel chipsets. The __cpuid function is updated. The /MP compiler option reduces total build time. The /Wp64 compiler option and __w64 keyword are deprecated. /Qfast_transcendentals /Qimprecise_fwaits

Linker

User Account Control information is now embedded into manifest files for executables by the Visual C++ linkerMFC Library The linker now has the /DYNAMICBASE option to enable the Address Space Layout Randomization feature of Windows Vista

http://msdn2.microsoft.com/en-us/library/bb384632.aspx

Whats new in Visual C++ 2008 SP 1


MFC
An expanded MFC library to support modern user interface

(UI) elements such as the Office Fluent UI, docking windows and MDI tabbed windows similar to those used in some releases of Visual Studio, enhanced toolbars, a rich new set of controls, support for controlling the overall visual style, support for desktop alerts, and much more. Enables you to build MFC applications that have the visual style of a Microsoft Office, Visual Studio, or Internet Explorer application. The MFC Feature Pack library provides customizable toolbars, menus, keyboards, menu bars, and docking panes.
http://blogs.msdn.com/vcblog/archive/2007/11/09/quick-tour-of-new-mfc-functionality.aspx

Whats new in Visual C++ 2008 SP 1


MFC

http://blogs.msdn.com/vcblog/archive/2007/11/09/quick-tour-of-new-mfc-functionality.aspx

Whats new in Visual C++ 2008 SP 1


MFC

http://blogs.msdn.com/vcblog/archive/2007/11/09/quick-tour-of-new-mfc-functionality.aspx

Whats new in Visual C++ 2008 SP 1


MFC

http://blogs.msdn.com/vcblog/archive/2007/11/09/quick-tour-of-new-mfc-functionality.aspx

Whats new in Visual C++ 2008 SP 1


MFC

http://blogs.msdn.com/vcblog/archive/2007/11/09/quick-tour-of-new-mfc-functionality.aspx

Whats new in Visual C++ 2008 SP 1


MFC

http://blogs.msdn.com/vcblog/archive/2007/11/09/quick-tour-of-new-mfc-functionality.aspx

Whats new in Visual C++ 2008 SP 1


Standard C++ Library TR1 Extensions
Implementation of the proposed extensions to the C++

ISO standard included in the draft document Technical Report 1. Microsoft's implementation includes support for fixed size arrays, function objects, hash tables, regular expressions, template metaprogramming, template types for aggregating related objects, and random number generation.
Portions of TR1 are scheduled for adoption in the

upcoming C++0x standard as the first major addition to the ISO 2003 standard C++ library.
http://blogs.msdn.com/vcblog/archive/2008/02/22/tr1-slide-decks.aspx

Whats new in Visual C++ 2008 SP 1


Standard C++ Library TR1 Extensions Headers

<array> <functional> <memory> <random> <regex> <tuple> <type_traits> <unordered_map> <unordered_set> <utility>

http://blogs.msdn.com/vcblog/archive/2008/02/25/channel-9-stephan-t-lavavej-digging-into-c-technical-report-1-tr1.aspx

STL/CLR
Bring STL idioms to CLR types
Same containers Same complexity Same iterators

And
Containers expose .NET collection interfaces IEnumerable, ICollection, IList, IDictionary Usable outside a single assembly

Marshaling
New library to simplify passing data between CComBSTR

native andSystem::String^code managed System::String^ wchar_t * ATL::CStringT<wchar_t> System::String^ Template-based pattern that applies to any kind System::String^ System::String^ bstr_t BSTR std::string of data System::String^ System::IntPtr HANDLE ATL::CStringT<char> Support lots of types out-of-the-box
System::String^ const char * System::String^ const wchar_t * System::String^

System::String^ System::String^ std::wstring

char *

Stateless Transition
I want to marshal between managed and native data types for conversions that do not require any lifetime management or complex resource allocation
#include <msclr/marshal.h> using namespace msclr::interop;
const char* sourcestring1 = teststring System::String^ deststring1; // Convert const char* to System::String^ using // TO to = marshal_as <TO> (from) deststring1 = marshal_as<System::String^>(sourcestring1);

Stateful Transition
I want to marshal between managed and native data types for conversions that require some kind of lifetime (memory, resource, etc)
#include <msclr/marshal.h> using namespace msclr::interop; System::String^ sourcestring1 = teststring const char* deststring1; // Convert System::String^ to const char* marshal_context ctx; deststring1 = ctx.marshal_as<const char*>(sourcestring1);

Elegant Interop
STL/CLR + Marshaling = Better Interop
#include <cliext\list> #include <cliext\adapter> // Take generic collection and transform into container. No copying void MyFunction(Generic::IList<int>^ list ) { cliext::collection_adapter<Generic::IList<int>> cont( list ); cliext::list<int> myList( cont.size() ); cliext::transform(cont.begin(), cont.end(),myList.begin(), cliext::bind2nd(cliext::plus<int>(),2)); }

Security
Lets review
/GS /SafeSEH DEP Compatibility (/NXCompat) Data Execution Prevention

New in Vista and Server 2008: ASLR


Linker switch (/DYNAMICBASE) to opt in to support

ASLR
http://msdn2.microsoft.com/en-us/library/bb430720.aspx

Build in Parallel
In 2005
Build Multiple Project in Parallel Tools > Options > Project and Solutions > Build and

Run > Parallel Project Builds

In 2008
Build Multiple Translation Units in Parallel /MP or /MPn (where n is no. of CPUs) Project Properties > C/C++ > Command Line >

Additional Options

Resources
Fabio Galuppo Blog
http://fabiogaluppo.spaces.live.com/

VC++ Blog http://blogs.msdn.com/vcblog

Visual C++ Developer Center


http://msdn2.microsoft.com/en-us/visualc/default.aspx

Comunidade C/C++ Brasil (Participe)


http://www.cbrasil.org/

Você também pode gostar