12.07.2015 Views

Visual Studio 2008로 가는 길

Visual Studio 2008로 가는 길

Visual Studio 2008로 가는 길

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Today’s Presentation• <strong>Visual</strong> <strong>Studio</strong> 2008로 가는 길• 향상된 보안/향상된 성능• 64비트 프로그램을 준비하라


<strong>Visual</strong> C++ Past and Present<strong>Visual</strong> C++ 6Release Date 1998 2002TargetPlatformsLibraries andTechnologiesDistinguishingFeaturesSupportWindows 95 toWindows NT 4.0Win32, COM,MFC, ATLIntroducedIntelliSenseExtended supportexpiresSeptember 30,2005<strong>Visual</strong> C++2002Windows 98 toWindows XPWin32, COM,MFC, ATL, .NET,Web ServicesIntroducedsupport for .NETExtended supportexpires June 30,2009<strong>Visual</strong> C++20052005 2008Windows 2000 toWindows Server2003Win32, COM,MFC, ATL, .NET,Web ServicesImproved supportfor .NET, ISOC++ and Windowsplatforms<strong>Visual</strong> C++2008Windows 2000 toWindows Server2003Win32, COM,MFC, ATL, .NET,Web ServicesImprovoedsupport forMFCNext, TR1and .NET 3.5? Just shipped


Benefits of <strong>Visual</strong> <strong>Studio</strong> 2008• 생산성 증가– 새로워진 IDE와 도구들– 스마트디바이스를 위한 개발 툴과 시뮬레이터• 보안성 증대– 보안성 검사 옵션을 기본 적용• 성능향상– 향상된 최적화 알고리즘– 최신 하드웨어의 새로운 기능을 적극 활용• 새로운 환경에 대한 대비– 새로운 C++ 표준에 맞는 코드 작성으로 인한 이식성 확보– 최신 윈도우 및 앞으로 출시될 윈도우의 기능에 대한 지원– 64bit 환경 지원– .NET Framework 및 WinFX 지원Be ready for servicing your applications!!


<strong>Visual</strong> C++ 2008로의 전환


<strong>Visual</strong> C++ 2008로의 전환


<strong>Visual</strong> C++ 2008로의 전환


<strong>Visual</strong> C++ 2008로의 전환


<strong>Visual</strong> C++ 2008로의 전환


프로젝트 파일의 변화<strong>Visual</strong> C++ 6.0 <strong>Visual</strong> C++ 2008


VC++ 2008 업그레이드시 주의사항No more implicit ‘int’const x = 0;const int x = 0;error C4430: missing type specifier - int assumed.Note: C++ does not support default-intCan also use /wd4430 to silence “warning”


VC++ 2008 업그레이드시 주의사항I/O stream changes#include #include int main(int argc, char *argv[]) {ifstream ifStream(argv[1], ios::nocreate);}#include #include using namespace std;int main(int argc, char *argv[]) {ifstream ifStream(argv[1], ios_base::in);}test.cpp(1) : fatal error C1083: Cannot open include file: 'iostream.h'iostream.h': No such filetest.cpp(2) : fatal error C1083: Cannot open include file: ‘fstream.h': No such filetest.cpp(5) : error C2653: 'ios'ios' ' : is not a class or namespace nametest.cpp(5) : error C2065: 'nocreate'nocreate' ' : undeclared identifier


VC++ 2008 업그레이드시 주의사항Pointer to Member requires an ‘&’class Foo {int Func(int x) {return x*x;}};…bar(objectFoo, Foo::Func, x);class Foo {int Func(int x) {return x*x;}};…bar(objectFoo, &Foo::Func, x);test.cpp(5) : error C3867: 'Foo::Func'Foo::Func': function call missing argument list; use'&Foo::FuncFoo::Func' ' to create a pointer to member


VC++ 2008 업그레이드시 주의사항‘using’ on nested type, not allowedclass Foo {};…using Foo::SubFoo;SubFoo object;class SubFoo {…};…class Foo {};…Foo::SubFoo object;class SubFoo {…};…error C2885: 'Foo::SubFoo'Foo::SubFoo': not a valid using-declaration at non-class scope


VC++ 2008 업그레이드시 주의사항/MAPINFO:LINES is no longer supported


Today’s Presentation• <strong>Visual</strong> <strong>Studio</strong> 2008로 가는 길• 향상된 보안/향상된향상된 성능• 64비트 프로그램을 준비하라


Buffer Overrun• Stack Overrun• Heap Overrun• Array Indexing Error• Format String Bugs• Unicode and ANSI buffer


Stack Overrun• Local buffer의 Writing overflow에 의해서 발생• Return 주소의값이변경됨void foo(const char* input){char buf[10];strcpy(buf, input);}


Stack Overrun• Stack의 구조로컬변수StackOverrun.exeStackOverrun.exeABCDEFGHIABCDEFGHIfoo()이전 EBPmain()foo() 복귀주소파라미터로컬변수이전 EBPmain() 복귀주소0x444342410x484746450x7FFD00490x0012FF800x004010A20x00370E6D


Heap Overrun• Overflow는 BadStringBuf의 값을 변경할 수 있다void BadFund(const char* input1){char* buf = NULL;buf = (char*)malloc(16);g_pInput = new BadStringBuf;}strcpy(buf, input1);


향상된 보안• Secure CRT• 버퍼오버런 방지 (/GS) 옵션 기본 적용– 스택에 선언되는 local변수, EBP, return address 그리고 예외처리 핸들러간의 관계를 검증• Static Code Analysis 지원


Secure CRTCRT deprecation warningsTCHAR szHello[MAX_LOADSTRING];_tcscpy(szHello, _T("Hello World!"));TCHAR szHello[MAX_LOADSTRING];_tcscpy_s(szHello, _T("Hello World!"));warning C4996: 'strcpy': This function or variable may be unsafe.


향상된 성능• 향상된 최적화 알고리즘 및 최신 하드웨어의 새로운 기능적극 활용– 새로운 프로세서에 최적화된 코드 생성– 향상된 floating point 연산 속도 및 정밀도 개선– 새로운 최적화 테크닉• Whole program optimization– 기존에는 각각의 OBJ 파일별 최적화– <strong>Visual</strong> C++ 2002에서 도입 후 지속적인 개선• 일반적 성능개선 기대치– VC++6에서 VC++2005로 변경할 때 20 ~ 30%의 성능개선


향상된 성능for(long idx=0; idx


향상된 성능SpecINT (<strong>Visual</strong> C++ 6 Baseline)20%18%16%14%12%10%8%6%4%2%0%VC7 /O2 VC7 /O2 /GL VC7.1 /O2 /G7 VC7.1 /O2 /G7 /arch:SSE2VC7.1 /O2 /GL /G7 VC7.1 /O2 /GL /G7 /arch:SSE2


향상된 성능SpecFP (<strong>Visual</strong> C++ 6 Baseline)40%35%30%25%20%15%10%5%0%VC7 /O2 VC7 /O2 /GL VC7.1 /O2 /G7 VC7.1 /O2 /G7 /arch:SSE2VC7.1 /O2 /GL /G7VC7.1 /O2 /GL /G7 /arch:SSE2


Today’s Presentation• <strong>Visual</strong> <strong>Studio</strong> 2008로 가는 길• 향상된 보안/향상된 성능• 64비트프로그램을 준비하라


Then and Now• Windows 3.0• “640K 메모리 장벽을 제거…”• “1 MB 시스템 시대가 도래…”• 64-bit Windows• “4 GB 메모리 장벽 극복”• “16 TERABYTES의 가상메모리지원”


64비트 CPU• Intel IA64• Intel EMT64 (X64 호환)• AMD X64


64비트 프로그램의 준비• 프로젝트에 64비트 플랫폼 지원 추가• Unaligned access로 인한 비효율성 제거• IA64에서의 crash 방지• Polymorphic data 지원• 하나의 프로젝트로 32/64비트 지원


프로젝트에 64비트 플랫폼 추가


프로젝트에 64비트 플랫폼 추가


Unaligned access로 인한 비효율성 제거• Misalignment can be fatal on Itanium• x64 handles alignment faults in hardware// Cause unalignment on 64-bit#pragma pack(push,4)struct CRecalcThreadInfo{char m_dummy;HWND m_hwndNotify;double m_nRecalcSpeed1;double m_nRecalcSpeed2;};#pragma pack(pop)


IA64에서의 crash 방지• For Itanium processor memory access should bealigned on “natural” boundaries.– Handle the fault silently (slow!) or– Raise an exception in user code• Following natural alignment benefits both Win32and Win64 appsUINT uOldMode = SetErrorMode(0);SetErrorMode(uOldMode | SEM_NOALIGNMENTFAULTEXCEPT);


Polymorphic data 지원• LLP64 data model// wrong!!long dwNewLong = GetWindowLong();// correct!!LONG_PTR dwNewLong = GetWindowLongPtr();


하나의 프로젝트로 32/64비트 지원• _WIN64• IsWow64Process#ifdef _WIN64#define ENDPART QuadPart#else#define ENDPART LowPart#endifpRecalcInfo->m_nRecalcSpeed1 =(double)(endCount.ENDPART-startCount.ENDPART) /freq.ENDPART;


Summary• <strong>Visual</strong> C++ 6.0에서 <strong>Visual</strong> C++ 2008로 이전하는 것은 생각보다어렵지 않다.• <strong>Visual</strong> C++ 2008로의 이전은 단순한 개발툴의 전환이 아니다.– C++는 20년간 이어져 왔으며 계속 발전하고 있다.– 하드웨어는 지속적으로 새로운 기술을 채용하고 있다.– 윈도우는 어플리케이션을 위해 새로운 최적화된 기능을 제공한다.• <strong>Visual</strong> C++ 2008에서 단순히 rebuild하는 것 만으로도 성능이 향상될 수 있다.• 프로젝트의 이전 과정에서 발생하는 모든 warning을 잡으려 하지마라!!• 64비트 환경에 대한 대비가 필요하다.


Reference• Porting Applications to VC2005: Part I / Microsoft• Moving Your Application Forward with <strong>Visual</strong> C++ 2005 /Microsoft• Channel 9: New Updates to MFC in <strong>Visual</strong> <strong>Studio</strong> 2008– http://channel9.msdn.com/• VC++ Team blog– http://blogs.msdn.com/vcblog/• Writing Secure Code 2nd• 64비트 윈도우 프로그래밍 / 마이크로소프트웨어, 2005, 유병인

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!