Welcome back to C++ RValue referencesForward declared enumsBidirectional fences...

23
Peter Torr, [email protected] Program Manager, Windows Phone Developer Platform Using C++ in your Windows Phone Applications

Transcript of Welcome back to C++ RValue referencesForward declared enumsBidirectional fences...

Page 1: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Peter Torr, [email protected] Manager, Windows Phone Developer Platform

Using C++ in your Windows Phone Applications

Page 2: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Agenda

C++ support in Windows Phone 8

When and why to use C++

Introduction to Windows (Phone) Runtime

~30 minutes of demos!

Page 3: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Welcome back to C++

Page 4: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.
Page 5: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

C++ support in Windows Phone 8Visual C++ 2012

Same as Windows 8

New C++11 features

Page 6: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

A sampling of C++ language features supported in Windows Phone 8

C++ support in Windows Phone 8

RValue references Forward declared enums Bidirectional fences

static_assert AlignmentData-dependency ordering

AutoStandard-layout and trivial types

exception_ptr

Trailing return types

Extended friend declarations Thread-local storage

LambdasLocal and unnamed types as template arguments

__func__

Decltype Range-based for-loop C99 preprocessor

Right angle brackets override and final long long

extern templates Minimal GC support

nullptr Atomics

Strongly typed enums Strong compare and exchange

Derived from http://msdn.microsoft.com/en-us/library/hh567368.aspx

Page 7: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Brief walk-through of key C++ features

Direct3D default template

DEMO:Quick tour of C++ features

Page 8: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

When and why to use C++

Page 9: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Using C++ in Windows Phone appsAll Windows Phone 8 apps can use native

code

Direct3D games: Pure native

XAML apps: Native compute + Direct3D

...but not all apps need to use native codeSee 3-046 for more on native games

Page 10: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Top 3 use cases for C++

There is no requirement to use C++ in your XAML apps

123

PerformanceReusabilityPortability

Page 11: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Using legacy code in Windows Phone 8 apps

DEMO:C++ code re-use

Page 12: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

reinterpret_cast<Phone>(WindowsRuntime)

Introduction to Windows (Phone) Runtime

Page 13: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

APIsInfrastructure

What is the Windows Runtime?

Core plumbing

Common type system

Standard programming

model

Windows Phone features

Libraries you write (or

license)

Projected to C++ and C# /

VB

Page 14: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

When is the Windows Runtime used?Calling APIs

Native / Managed Interop

Direct3D game app model

Page 15: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Calling APIs from C#

Creating a component in C++ and using from C#

The magic of async

DEMO:Windows Runtime

Page 16: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Writing portable components

Page 17: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Sharing code across platforms

With iOS and Android:Standard C and C++Common librariesMiddleware providers

With Windows 8, add:Windows RuntimeWin32 and COM

See 3-043 for more on Windows 8 portability

Page 18: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Real-world example of common open source library

Another look at async

DEMO:Using SQLite in Windows Phone 8

Page 19: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Wrap-up

Page 20: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Key takeaways for using C++

All Windows Phone 8 apps can use C++

C++ enables portability and code re-use

Windows Runtime is the key to unlocking

APIs

Page 21: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Please fill out an evaluation form!

Page 22: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

Related sessions (live or on-line)

Session

Title Speaker

3-046 Native C/C++ Game Development Sam George

3-047Networking, Bluetooth, and NFC Proximity for Developers Tim Laverty

3-043How to leverage your code across WP8 and Windows 8

Andrew Byrne et al

2-018 Photo and Lens Apps Eric Bennett

4-001The power of C++ - Project Austin(not phone specific, but a great talk)

Ale Contenti

Page 23: Welcome back to C++ RValue referencesForward declared enumsBidirectional fences static_assertAlignmentData-dependency ordering AutoStandard-layout.

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.