Size: px
Start display at page:

Download ""

Transcription

1

2

3

4

5 class Foo public: bool Bar() IUnknown * punk = NULL; HRESULT hr = CoCreateInstance(SOME_CLSID, NULL, CLSCTX_LOCAL_SERVER, SOME_IID, (LPVOID*)&pUnk); if (SUCCEEDED(hr)) // do some work... punk->release(); return true; return false; // do some other work... ;

6 class Foo public: bool Bar() IUnknown * punk = NULL; HRESULT hr = CoCreateInstance(SOME_CLSID, NULL, CLSCTX_LOCAL_SERVER, SOME_IID, (LPVOID*)&pUnk); if (SUCCEEDED(hr)) // do some work... punk->release(); return true; return false; // do some other work... private: virtual HRESULT CoCreateInstance( in REFCLSID rclsid, in_opt LPUNKNOWN punkouter, i return ::CoCreateInstance(rclsid, punkouter, dwclscontext, riid, ppv); ;

7 TESTMETHOD(TestSubclass) class TestFoo : public Foo private: virtual HRESULT CoCreateInstance( in REFCLSID rclsid, in_opt LPUNKNOWN punkouter, return E_NOINTERFACE; ; assert(false == TestFoo().Bar());

8 class Foo public: static bool Bar() IUnknown * punk = NULL; HRESULT hr = CoCreateInstance(SOME_CLSID, NULL, CLSCTX_LOCAL_SERVER, SOME_IID, (LPVOID*)&pUnk); if (SUCCEEDED(hr)) // do some work... punk->release(); return true; // do some other work... return false; ;

9 struct Empty; template<typename Base> class FooT : public Base public: static bool Bar() IUnknown * punk = NULL; HRESULT hr = CoCreateInstance(SOME_CLSID, NULL, CLSCTX_LOCAL_SERVER, SOME_IID, (LPVOID*)&pUnk); if (SUCCEEDED(hr)) // do some work... punk->release(); return true; // do some other work... return false; ; typedef FooT<Empty> Foo;

10 TESTMETHOD(TBCIMockingCAPIWithEllipsis) struct TestBase static HRESULT CoCreateInstance(...) return E_NOINTERFACE; ; assert(false == FooT<TestBase>().Bar()); ;

11 TESTMETHOD(TBCIMockingCAPIWithData) struct TestBase struct MyUnknown : public IUnknown ULONG ul; MyUnknown() : ul(1) virtual HRESULT QueryInterface(REFIID riid, void**ppvobject) return E_FAIL; virtual ULONG STDMETHODCALLTYPE AddRef () return ++ul; virtual ULONG STDMETHODCALLTYPE Release() return --ul; m_unk; HRESULT CoCreateInstance(REFCLSID rclsid, LPUNKNOWN punkouter, DWORD dwclscontext, R *ppv = &m_unk; return S_OK; ; FooT<TestBase> foo; assert(true == foo.bar()); assert(0 == foo.m_unk.ul); ;

12 class Foo public: bool Bar2() Baz baz; if (baz.isittrue()) // do some work... return true; // do some other work... return false; ;

13 struct Empty; template<typename Base> class FooT : public Base public: bool Bar2() Baz baz; if (baz.isittrue()) // do some work... return true; // do some other work... return false; ; typedef FooT<Empty> Foo;

14 TESTMETHOD(TBCIMockingAnAutomaticVariable) struct TestBase struct Baz bool IsIsTrue() return true; ; ; assert(true == FooT<TestBase>().Bar2()); ;

15 class Foo public: bool Bar3() Abc abc; HRESULT hr1 = abc.dowork(); Def def; HRESULT hr2 = def.dowork(); return (SUCCEEDED(hr1) && SUCCEEDED(hr2)); ;

16 struct Empty; template<typename Base> class FooT : public Base public: bool Bar3() Abc abc; HRESULT hr1 = abc.dowork(); Def def; HRESULT hr2 = def.dowork(); return (SUCCEEDED(hr1) && SUCCEEDED(hr2)); ; typedef FooT<Empty> Foo;

17 struct AbcFailing HRESULT DoWork() return E_FAIL; ; struct AbcSucceed HRESULT DoWork() return S_OK; ; struct DefFailing HRESULT DoWork() return E_FAIL; ; struct DefSucceed HRESULT DoWork() return S_OK; ; template<typename A, typename D> struct TestBaseT typedef A Abc; typedef D Def; ; TESTMETHOD(CompositingMocks) assert(false == (FooT<TestBaseT<AbcFailing, DefFailing>>().Bar3())); assert(false == (FooT<TestBaseT<AbcFailing, DefSucceed>>().Bar3())); assert(false == (FooT<TestBaseT<AbcSucceed, DefFailing>>().Bar3())); assert( true == (FooT<TestBaseT<AbcSucceed, DefSucceed>>().Bar3()));

18

19

20

21 struct Empty typedef ::Baz Baz; ; template<typename Base> class FooT : public Base using typename Base::Baz; public: bool Bar2() Baz baz; if (baz.isittrue()) // do some work... return true; // do some other work... return false; ; typedef FooT<Empty> Foo;

22 struct Empty static inline HRESULT CoCreateInstance( in REFCLSID rclsid, in_opt LPUNKNOWN punkouter, return ::CoCreateInstance(rclsid, punkouter, dwclscontext, riid, ppv); ; template<typename Base> class FooT : public Base using Base::CoCreateInstance; public: static bool Bar() IUnknown * punk = NULL; HRESULT hr = CoCreateInstance(SOME_CLSID NULL, CLSCTX_LOCAL_SERVER, SOME_IID, (LPVOI if (SUCCEEDED(hr)) // do some work... punk->release(); return true; return false; // do some other work... ; typedef FooT<Empty> Foo;

23 #ifdef TESTING #define TESTABLESTRUCT(c) template<typename Base> struct c : public Base #else #define TESTABLESTRUCT(c) struct c #endif // kernel.c TESTABLESTRUCT(Foo) bool Bar2() Baz baz; if (baz.isittrue()) // do some work... return true; // do some other work... return false; ;

24 // kerneltests.cpp #define TESTING #include kernel.c TESTMETHOD(KernelModeExample) struct TestBase struct Baz bool IsIsTrue() return true; ; ; assert(true == Foo<TestBase>().Bar2());

25

James

James https://www.flickr.com/photos/giuseppemilo/40760404654 James Forshaw @tiraniddo Who am I? Researcher in Google s Project Zero Specialize in Windows Especially local privilege escalation Logical vulnerability

More information

Asynchronous Calls. Standard COM+ model is completely synchronous

Asynchronous Calls. Standard COM+ model is completely synchronous Asynchronous Calls Standard COM+ model is completely synchronous Emulates standard procedure calls Problematic in distributed scenarios with high network latencies Use threads to handle multiple calls

More information

Microsoft Office CTaskSymbol Use- After-Free Vulnerability

Microsoft Office CTaskSymbol Use- After-Free Vulnerability Microsoft Office CTaskSymbol Use- After-Free Vulnerability 17/08/2015 Software: Microsoft Office Affected Versions: MS Office 2013 SP1 (x86, x64) CVE Reference: Author: Severity: Vendor: Vendor Response:

More information

Administrivia. CMSC433, Fall 2001 COM - Component Object Model. Immutable interfaces. Component Object Model COM. Multiple interfaces

Administrivia. CMSC433, Fall 2001 COM - Component Object Model. Immutable interfaces. Component Object Model COM. Multiple interfaces Administrivia CMSC433, Fall 2001 COM - Component Object Model Alan Sussman December 4, 2001 Project 6 due Monday, 12/10, and commentary for Project 5 grading guidelines posted No office hours tomorrow

More information

DirectPlay. What is DirectPlay? Vishnu Kotrajaras, PhD

DirectPlay. What is DirectPlay? Vishnu Kotrajaras, PhD DirectPlay Vishnu Kotrajaras, PhD What is DirectPlay? It is a multiplayer component of DirectX It abstracts communication methods away Same function call for communication by TCP/IP, serial cable and modem

More information

https://pixabay.com/en/hong-kong-city-urban-skyscrapers /

https://pixabay.com/en/hong-kong-city-urban-skyscrapers / https://pixabay.com/en/hong-kong-city-urban-skyscrapers-1990268/ Agenda Component Object Model (COM) Internals Attacking COM Enumerating attack surface for EoP Reverse engineering COM components Bugs and

More information

LIN2CAN API (L2CAPI) MANUAL ENGLISH

LIN2CAN API (L2CAPI) MANUAL ENGLISH LIN2CAN API (L2CAPI) MANUAL ENGLISH HMS Technology Center Ravensburg GmbH Helmut-Vetter-Straße 2 88213 Ravensburg Germany Tel.: +49 751 56146-0 Fax: +49 751 56146-29 Internet: www.hms-networks.de E-Mail:

More information

Outline. COM overview. DCOM overview. Comparison DCOM and Corba

Outline. COM overview. DCOM overview. Comparison DCOM and Corba DCOM Overview 1 Outline COM overview DCOM overview Comparison DCOM and Corba 2 COM overview Standard for component interoperability binary standard specifies how the component should be represented in

More information

AN ABSTRACT OF THE PROJECT OF

AN ABSTRACT OF THE PROJECT OF AN ABSTRACT OF THE PROJECT OF Li Zhang for the degree of the Master of Science in Computer Science Presented on Jan. 17, 2002 Title: The Event Listener Events are an important concept in the Microsoft

More information

Chapter 24. A DirectX 5 Update

Chapter 24. A DirectX 5 Update Chapter 24 I A DirectX 5 Update Why Read This Chapter? Time waits for no person. While we were putting our book together, Microsoft was working on the next generation of DirectX DirectX foundation 5. In

More information

speller.c dictionary contains valid words, one per line 1. calls load on the dictionary file

speller.c dictionary contains valid words, one per line 1. calls load on the dictionary file mispellings speller.c 1. calls load on the dictionary file dictionary contains valid words, one per line 2. calls check on each word in the text file and prints all misspelled words 3. calls size to determine

More information

OrbixCOMet Desktop Getting Started

OrbixCOMet Desktop Getting Started OrbixCOMet Desktop Getting Started IONA Technologies PLC April 1999 Orbix is a Registered Trademark of IONA Technologies PLC. OrbixCOMet (TM) is a Trademark of IONA Technologies PLC. While the information

More information

Debug C++ Without Running. Anastasia Kazakova

Debug C++ Without Running. Anastasia Kazakova Debug C++ Without Running Anastasia Kazakova JetBrains @anastasiak2512 Agenda 1. Tricky C++ language. Show samples! 2. Seems to help but it doesn t. Why? Running / Debugging Static / dynamic code analysis

More information

Lists. linking nodes. constructors. chasing pointers. MCS 360 Lecture 11 Introduction to Data Structures Jan Verschelde, 17 September 2010.

Lists. linking nodes. constructors. chasing pointers. MCS 360 Lecture 11 Introduction to Data Structures Jan Verschelde, 17 September 2010. 1 2 3 MCS 360 Lecture 11 Introduction to Data Structures Jan Verschelde, 17 September 2010 1 2 3 efficient updates with lists At http://www.sgi.com/tech/stl/ is the Standard Template Library Programmer

More information

Jordan University of Science & Technology Department of Computer Science CS 211 Exam #1 (23/10/2010) -- Form A

Jordan University of Science & Technology Department of Computer Science CS 211 Exam #1 (23/10/2010) -- Form A Jordan University of Science & Technology Department of Computer Science CS 211 Exam #1 (23/10/2010) -- Form A Name: ID#: Section #: Day & Time: Instructor: Answer all questions as indicated. Closed book/closed

More information

Friendship in Service of Testing

Friendship in Service of Testing Friendship in Service of Testing Gábor Márton, martongabesz@gmail.com Zoltán Porkoláb, gsd@elte.hu 1 / 47 Agenda Introduction, principals Case study Making the example better Vision 2 / 47 Functional Programming

More information

Adventures in a Legacy Codebase JAMES MCNELLIS SENIOR SOFTWARE ENGINEER MICROSOFT VISUAL C++

Adventures in a Legacy Codebase JAMES MCNELLIS SENIOR SOFTWARE ENGINEER MICROSOFT VISUAL C++ Adventures in a Legacy Codebase JAMES MCNELLIS SENIOR SOFTWARE ENGINEER MICROSOFT VISUAL C++ James s Vacation Photos JAMES MCNELLIS SENIOR SOFTWARE ENGINEER MICROSOFT VISUAL C++ Adventures in a Legacy

More information

MEA 3.1 Geo-Location Programmers Reference Guide Documentation Revision 3.1.3

MEA 3.1 Geo-Location Programmers Reference Guide Documentation Revision 3.1.3 MEA 3.1 Geo-Location Programmers Reference Guide Documentation Revision 3.1.3 Mesh Enabled Architecture Geo-Location Reference Guide Copyrights The Motorola products described in this document may include

More information

B-Trees. nodes with many children a type node a class for B-trees. an elaborate example the insertion algorithm removing elements

B-Trees. nodes with many children a type node a class for B-trees. an elaborate example the insertion algorithm removing elements B-Trees 1 B-Trees nodes with many children a type node a class for B-trees 2 manipulating a B-tree an elaborate example the insertion algorithm removing elements MCS 360 Lecture 35 Introduction to Data

More information

CS109A ML Notes for the Week of 1/16/96. Using ML. ML can be used as an interactive language. We. shall use a version running under UNIX, called

CS109A ML Notes for the Week of 1/16/96. Using ML. ML can be used as an interactive language. We. shall use a version running under UNIX, called CS109A ML Notes for the Week of 1/16/96 Using ML ML can be used as an interactive language. We shall use a version running under UNIX, called SML/NJ or \Standard ML of New Jersey." You can get SML/NJ by

More information

Type Erasure. Nevin :-) Liber Friday, October 29, Chicago C/C++ Users Group Nevin J. Liber All Rights Reserved.

Type Erasure. Nevin :-) Liber Friday, October 29, Chicago C/C++ Users Group Nevin J. Liber All Rights Reserved. Type Erasure Nevin :-) Liber nevin@eviloverlord.com 2010 Nevin J. Liber All Rights Reserved. Chicago C/C++ Users Group 1 Type Erasure Type Erasure Pattern boost::any boost::function expression templates

More information

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT

C Review. MaxMSP Developers Workshop Summer 2009 CNMAT C Review MaxMSP Developers Workshop Summer 2009 CNMAT C Syntax Program control (loops, branches): Function calls Math: +, -, *, /, ++, -- Variables, types, structures, assignment Pointers and memory (***

More information

1d: tests knowing about bitwise fields and union/struct differences.

1d: tests knowing about bitwise fields and union/struct differences. Question 1 1a: char ptr[] = Hello World ; char a = ptr[1], b = *(ptr+6); Creates an array of 12 elements, 11 visible letters and a character value 0 at the end. i true ii true iii false iv false v true

More information

Modelling Microsoft COM Using π-calculus

Modelling Microsoft COM Using π-calculus Modelling Microsoft COM Using π-calculus Loe M.G. Feijs Philips Research Laboratories and EESI TUE feijs@natlab.research.philips.com and feijs@win.tue.nl Abstract. We use the π-calculus to model aspects

More information

@odinthenerd. not the god. Auto-Intern GmbH 1

@odinthenerd. not the god. Auto-Intern GmbH 1 @odinthenerd not the god Auto-Intern GmbH 1 Auto-Intern GmbH 2 You are awesome! I m not impressed Auto-Intern GmbH 3 You are awesome! I m not impressed Auto-Intern GmbH 4 You are awesome! I m not impressed

More information

Questions: ECE551 PRACTICE Final

Questions: ECE551 PRACTICE Final ECE551 PRACTICE Final This is a full length practice midterm exam. If you want to take it at exam pace, give yourself 175 minutes to take the entire test. Just like the real exam, each question has a point

More information

Java - First Impressions for a C++ Programmer

Java - First Impressions for a C++ Programmer Steven Zeil October 25, 2013 Contents 1 Program Structure 3 2 Program Structure == File Structure 6 3 Swimming in Pointers 31 4 Exceptions 34 5 Corresponding Data Structures 38 1 Moving from C++ to Java

More information

Interfacing Ada 95 to Microsoft COM and DCOM Technologies

Interfacing Ada 95 to Microsoft COM and DCOM Technologies Interfacing Ada 95 to Microsoft COM and DCOM Technologies Interactive Intelligence, Inc. 600 West Hillsboro Blvd., Suit 325 Deerfield Beach, Florida 33441 (954) 698-0030x187 David Botton David@Botton.com

More information

Version: 2.03 Language: English Date: 2011/01/31. UDVGuard Software Development Kits (SDK)

Version: 2.03 Language: English Date: 2011/01/31. UDVGuard Software Development Kits (SDK) Version: 2.03 Language: English Date: 2011/01/31 UDVGuard Software Development Kits (SDK) Introduction: UDVGuard.exe is an ActiveX component including OLE Automation interface. For each DoorPhone must

More information

Binary Trees and Binary Search Trees

Binary Trees and Binary Search Trees Binary Trees and Binary Search Trees Learning Goals After this unit, you should be able to... Determine if a given tree is an instance of a particular type (e.g. binary, and later heap, etc.) Describe

More information

DirectX Programming Introduction

DirectX Programming Introduction DirectX Programming Introduction DirectX is implemented as a collection of COM objects To use a DirectX program, the user must have the correct (or later) version of DirectX installed (e.g. by doing Windows

More information

CSE 333 Midterm Exam 7/27/15 Sample Solution

CSE 333 Midterm Exam 7/27/15 Sample Solution Question 1. (24 points) C programming. In this problem we want to implement a set of strings in C. A set is represented as a linked list of strings with no duplicate values. The nodes in the list are defined

More information

Chapter 20: Binary Trees

Chapter 20: Binary Trees Chapter 20: Binary Trees 20.1 Definition and Application of Binary Trees Definition and Application of Binary Trees Binary tree: a nonlinear linked list in which each node may point to 0, 1, or two other

More information

CS32 Discussion Sec.on 1B Week 2. TA: Zhou Ren

CS32 Discussion Sec.on 1B Week 2. TA: Zhou Ren CS32 Discussion Sec.on 1B Week 2 TA: Zhou Ren Agenda Copy Constructor Assignment Operator Overloading Linked Lists Copy Constructors - Motivation class School { public: }; School(const string &name); string

More information

Solveig Multimedia AVI Trimmer Component

Solveig Multimedia AVI Trimmer Component Solveig Multimedia AVI Trimmer Component Developer Reference Manual Copyright 2004-2005 Solveig Multimedia. All rights reserved. Notices For information contact Solveig Multimedia: info@solveigmm.com For

More information

Doubly-Linked Lists

Doubly-Linked Lists Doubly-Linked Lists 4-02-2013 Doubly-linked list Implementation of List ListIterator Reading: Maciel, Chapter 13 HW#4 due: Wednesday, 4/03 (new due date) Quiz on Thursday, 4/04, on nodes & pointers Review

More information

speller.c dictionary contains valid words, one per line 1. calls load on the dictionary file

speller.c dictionary contains valid words, one per line 1. calls load on the dictionary file mispellings speller.c 1. calls load on the dictionary file dictionary contains valid words, one per line 2. calls check on each word in the text file and prints all misspelled words 3. calls size to determine

More information

In an enterprise system, maintaining the

In an enterprise system, maintaining the 8867D-7-08 8/16/00 11:23 AM Page 363 C H A P T E R 8 Transactions In an enterprise system, maintaining the integrity of data across various applications and machines is critical. Regardless of the scope

More information

Linked List using a Sentinel

Linked List using a Sentinel Linked List using a Sentinel Linked List.h / Linked List.h Using a sentinel for search Created by Enoch Hwang on 2/1/10. Copyright 2010 La Sierra University. All rights reserved. / #include

More information

boost::enable_if Deep Down Boostimagical Fun Christian Bay and Kasper A Andersen Department of Computer Science University of Copenhagen

boost::enable_if Deep Down Boostimagical Fun Christian Bay and Kasper A Andersen Department of Computer Science University of Copenhagen Deep Down Boostimagical Fun boost::enable_if Christian Bay and Kasper A Andersen Department of Computer Science University of Copenhagen C. Bay and K. A. Andersen, June 2, 2006 p. 1/12 SFINAE revisited

More information

Contract Programming For C++0x

Contract Programming For C++0x Contract Programming For C++0x WG21/N1800 and J16/05-0060 Lawrence Crowl and Thorsten Ottosen lawrence.crowl@sun.com and nesotto@cs.aau.dk 2005-04-27 Overview This is an annotated version of the presentation

More information

C++ Module TS Issues List Gabriel Dos Reis Microsoft

C++ Module TS Issues List Gabriel Dos Reis Microsoft P0501R3 2018-01-30 Reply-To: gdr@microsoft.com Active Issues C++ Module TS Issues List Gabriel Dos Reis Microsoft [5] Static local variables [John Spicer, 11/8/2016] Should there be a restriction on local

More information

Structuur van Computerprogramma s 2

Structuur van Computerprogramma s 2 Structuur van Computerprogramma s 2 dr. Dirk Deridder Dirk.Deridder@vub.ac.be http://soft.vub.ac.be/ Vrije Universiteit Brussel - Faculty of Science and Bio-Engineering Sciences - Computer Science Department

More information

G52CPP C++ Programming Lecture 8. Dr Jason Atkin

G52CPP C++ Programming Lecture 8. Dr Jason Atkin G52CPP C++ Programming Lecture 8 Dr Jason Atkin 1 Last lecture Dynamic memory allocation Memory re-allocation to grow arrays Linked lists Use -> rather than. pcurrent = pcurrent -> pnext; 2 Aside: do not

More information

Tokens, Expressions and Control Structures

Tokens, Expressions and Control Structures 3 Tokens, Expressions and Control Structures Tokens Keywords Identifiers Data types User-defined types Derived types Symbolic constants Declaration of variables Initialization Reference variables Type

More information

CS201 - Assignment 3, Part 1 Due: Friday February 28, at the beginning of class

CS201 - Assignment 3, Part 1 Due: Friday February 28, at the beginning of class CS201 - Assignment 3, Part 1 Due: Friday February 28, at the beginning of class One of the keys to writing good code is testing your code. This assignment is going to introduce you and get you setup to

More information

A C++ Class Designer s Checklist

A C++ Class Designer s Checklist Steven J. Zeil August 28, 2013 Contents 1 The Checklist 2 2 Discussion and Explanation 3 2.1 Is the interface complete?........ 3 2.2 Are there redundant functions or functions that can be generalized?............................

More information

The Stack ADT. Stacks. The Stack ADT. The Stack ADT. Set of objects in which the location an item is inserted and deleted is prespecified.

The Stack ADT. Stacks. The Stack ADT. The Stack ADT. Set of objects in which the location an item is inserted and deleted is prespecified. The Stack ADT Stacks Set of objects in which the location an item is inserted and deleted is prespecified Stacks! Insert in order! Delete most recent item inserted! LIFO - last in, first out Stacks 2 The

More information

Expression Trees and the Heap

Expression Trees and the Heap Expression Trees and the Heap 1 Binary Expression Trees evaluating expressions splitting strings in operators and operands 2 C++ Binary Tree of Strings header files defining the methods 3 the Heap or Priority

More information

EECS 311 Data Structures Midterm Exam Don t Panic!

EECS 311 Data Structures Midterm Exam Don t Panic! April 5, 7 EECS Data Structures Midterm Exam Don t Panic!. ( pts) In each box below, show the AVL trees that result from the successive addition of the given elements. Show the nodes, links and balance

More information

ANSI C Changes. Jonathan Hoyle Eastman Kodak 10/5/00

ANSI C Changes. Jonathan Hoyle Eastman Kodak 10/5/00 ANSI C Changes Jonathan Hoyle Eastman Kodak 10/5/00 ANSI C Changes Introduction Changes to C in conformance to C++ New additions to C friendly to C++ New additions to C unfriendly to C++ What has not changed

More information

Fundamentals of Type-Dependent Code Reuse in C++ Mark Isaacson

Fundamentals of Type-Dependent Code Reuse in C++ Mark Isaacson Fundamentals of Type-Dependent Code Reuse in C++ Mark Isaacson Roadmap Reusing an implementation Selecting between implementations Opt-in functions A Beginning assert(max(3, 5) == 5); assert(max("abc"s,

More information

BreatheExample Documentation

BreatheExample Documentation BreatheExample Documentation Release v4.7.3 Michael Jones Oct 09, 2017 Contents 1 Overview 3 2 Setup & Usage 5 3 Features 49 4 Contributing 69 5 Example/Test Pages 75 6 Download 133 7 License 135 8 In

More information

Appendix. Grammar. A.1 Introduction. A.2 Keywords. There is no worse danger for a teacher than to teach words instead of things.

Appendix. Grammar. A.1 Introduction. A.2 Keywords. There is no worse danger for a teacher than to teach words instead of things. A Appendix Grammar There is no worse danger for a teacher than to teach words instead of things. Marc Block Introduction keywords lexical conventions programs expressions statements declarations declarators

More information

CA Data Protection. External Agent COM API Reference Guide. Release 15.0

CA Data Protection. External Agent COM API Reference Guide. Release 15.0 CA Data Protection External Agent COM API Reference Guide Release 15.0 This Documentation, which includes embedded help systems and electronically distributed materials (hereinafter referred to as the

More information

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures The main body and cout Agenda 1 Fundamental data types Declarations and definitions Control structures References, pass-by-value vs pass-by-references The main body and cout 2 C++ IS AN OO EXTENSION OF

More information

How to Win Coding Competitions: Secrets of Champions. Week 2: Computational complexity. Linear data structures Lecture 4: List

How to Win Coding Competitions: Secrets of Champions. Week 2: Computational complexity. Linear data structures Lecture 4: List How to Win Coding Competitions: Secrets of Champions Week 2: Computational complexity. Linear data structures Lecture 4: List Pavel Krotkov Saint Petersburg 2016 Operations on list Let s define operations

More information

Development of the Pilot Application in Delphi COT/3-10-V1.1. Centre for Object Technology

Development of the Pilot Application in Delphi COT/3-10-V1.1. Centre for Object Technology Development of the Pilot Application in Delphi COT/3-10-V1.1 C * O T Centre for Revision history: V0.1 18-08-98 First draft. V1.0 20-08-98 General revisions V1.1 08-09-98 First public version. Author(s):

More information

CSCE 110 PROGRAMMING FUNDAMENTALS

CSCE 110 PROGRAMMING FUNDAMENTALS CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 16. Linked Lists Prof. amr Goneid, AUC 1 Linked Lists Prof. amr Goneid, AUC 2 Linked Lists The Linked List Structure Some Linked List

More information

The Evolution of a Programmer

The Evolution of a Programmer The Evolution of a Programmer High School/Jr.High 10 PRINT "HELLO WORLD" 20 END First year in College public class Hello public static void main( String args ) System.out.println( "Hello World" ); Senior

More information

Lecture Notes CPSC 122 (Fall 2014) Today Quiz 7 Doubly Linked Lists (Unsorted) List ADT Assignments Program 8 and Reading 6 out S.

Lecture Notes CPSC 122 (Fall 2014) Today Quiz 7 Doubly Linked Lists (Unsorted) List ADT Assignments Program 8 and Reading 6 out S. Today Quiz 7 Doubly Linked Lists (Unsorted) List ADT Assignments Program 8 and Reading 6 out S. Bowers 1 of 11 Doubly Linked Lists Each node has both a next and a prev pointer head \ v1 v2 v3 \ tail struct

More information

: Principles of Imperative Computation Victor Adamchik. Practice Exam - I

: Principles of Imperative Computation Victor Adamchik. Practice Exam - I 15-122 Practice Exam - I Page 1 of 10 15-122 : Principles of Imperative Computation Victor Adamchik Practice Exam - I Name: Andrew ID: Answer the questions in the space provided following each question.

More information

#ifndef DOUBLE_LIST /* this string SHOULD NOT previously exist */ #define DOUBLE_LIST

#ifndef DOUBLE_LIST /* this string SHOULD NOT previously exist */ #define DOUBLE_LIST /* This is a personal header file. Call it double_list.h * Its name should be reflected into the macro definition (#define). * For instance, here I should say something like: * #define DOUBLE_LIST #ifndef

More information

Queue Implementations

Queue Implementations Queue Implementations 1 Circular Queues buffer of fixed capacity improvements and cost estimates 2 Deques the double ended queue queue as double linked circular list MCS 360 Lecture 17 Introduction to

More information

OpenDevice - Device Translator Template Guide

OpenDevice - Device Translator Template Guide OpenDevice - Device Translator Template Guide Copyright 2002-2012 Lenel Systems International, Inc. 1 Table of Contents Device Translator Template... 8 CDeviceTranslator... 15 ~CDeviceTranslator... 16

More information

CSC324- TUTORIAL 5. Shems Saleh* *Some slides inspired by/based on Afsaneh Fazly s slides

CSC324- TUTORIAL 5. Shems Saleh* *Some slides inspired by/based on Afsaneh Fazly s slides CSC324- TUTORIAL 5 ML Shems Saleh* *Some slides inspired by/based on Afsaneh Fazly s slides Assignment 1 2 More questions were added Questions regarding the assignment? Starting ML Who am I? Shems Saleh

More information

What Code Generation Can Do for You. Marc-Antoine Sauvé

What Code Generation Can Do for You. Marc-Antoine Sauvé What Code Generation Can Do for You Marc-Antoine Sauvé Hopper Hopper Creates Trust from Data We process 300 billion flight prices each month to build trust and optimize customer interactions. Repetitive

More information

SYSC 2006 Winter 2012 Linear Collections: Queues

SYSC 2006 Winter 2012 Linear Collections: Queues SYSC 2006 Winter 2012 Linear Collections: Queues Copyright 2000-2012 D.L. Bailey, Systems and Computer Engineering, Carleton University revised March 20, 2011, November 28, 2011, March 30, 2012 Definition

More information

STRICT_VARIANT. A simpler variant in C++ Chris Beck

STRICT_VARIANT. A simpler variant in C++ Chris Beck STRICT_VARIANT A simpler variant in C++ Chris Beck https://github.com/cbeck88/strict_variant What is a variant? A variant is a heterogenous container. std::vector many objects of one type std::variant

More information

Design 'Specification. "OLE for Design & Modeling Applications"

Design 'Specification. OLE for Design & Modeling Applications 01 C ro..c c « "OLE for Design & Modeling Applications" Design 'Specification April 14, 1995 Contents 1.INTRODUCTION 138 1.1. The "OLE for Design & Modeling Applications" Council 138 1.2. Organization

More information

Midterm I Exam Principles of Imperative Computation Frank Pfenning, Tom Cortina, William Lovas. September 30, 2010

Midterm I Exam Principles of Imperative Computation Frank Pfenning, Tom Cortina, William Lovas. September 30, 2010 Midterm I Exam 15-122 Principles of Imperative Computation Frank Pfenning, Tom Cortina, William Lovas September 30, 2010 Name: Andrew ID: Instructions This exam is closed-book with one sheet of notes permitted.

More information

Objectives. Introduce static keyword examine syntax describe common uses

Objectives. Introduce static keyword examine syntax describe common uses Static Objectives Introduce static keyword examine syntax describe common uses 2 Static Static represents something which is part of a type rather than part of an object Two uses of static field method

More information

MetaProgramming. Programming from above. Python. C++ (Template MetaProgramming TMP)

MetaProgramming. Programming from above. Python. C++ (Template MetaProgramming TMP) MetaProgramming Programming from above Python C++ (Template MetaProgramming TMP) Python (based on David Beazley @dabeaz) Debugging with Print A function def add(x, y): return x + y A function with debugging

More information

Report Concerning Space Data System Standards SPACE LINK EXTENSION APPLICATION PROGRAM INTERFACE FOR TRANSFER SERVICES APPLICATION PROGRAMMER S GUIDE

Report Concerning Space Data System Standards SPACE LINK EXTENSION APPLICATION PROGRAM INTERFACE FOR TRANSFER SERVICES APPLICATION PROGRAMMER S GUIDE Report Concerning Space Data System Standards SPACE LINK EXTENSION APPLICATION PROGRAM INTERFACE FOR TRANSFER SERVICES APPLICATION PROGRAMMER S GUIDE INFORMATIONAL REPORT CCSDS 914.2-G-2 GREEN BOOK October

More information

AntennaSmith Windows API

AntennaSmith Windows API AntennaSmith Windows API BOOL WINAPI AS_Connect(int nport void WINAPI AS_Disconnect(void void WINAPI AS_LoadRanges(int nrange=-1 void WINAPI AS_LoadReferences(int nref=-1 void WINAPI AS_SendCmdErrors(BOOL

More information

Introduction to C++11 and its use inside Qt

Introduction to C++11 and its use inside Qt Introduction to C++11 and its use inside Qt Olivier Goffart February 2013 1/43 Introduction to C++11 and its use inside Qt About Me http://woboq.com http://code.woboq.org 2/43 Introduction to C++11 and

More information

template<typename T> cout << "The value is << value << endl; } void printdata(t value){

template<typename T> cout << The value is << value << endl; } void printdata(t value){ C++ Templates Parametric Polymorphism void printdata(int value){ cout

More information

A Proposal to Add a Logical Const Wrapper to the Standard Library Technical Report

A Proposal to Add a Logical Const Wrapper to the Standard Library Technical Report Doc number: N3973 Date: 2014-05-12 Project: Programming Language C++, Library Evolution Working Group Reply-to: Jonathan Coe Robert Mill A Proposal to Add a Logical

More information

OpenDevice Device Translator Template Guide

OpenDevice Device Translator Template Guide OpenDevice Device Translator Template Guide July 19, 2016 1 Table of Contents Device Translator Template... 8 CDeviceTranslator... 15 ~CDeviceTranslator... 16 DecodeSegmentValue... 17 GetCmd... 18 SetCmd...

More information

University of Technology. Laser & Optoelectronics Engineering Department. C++ Lab.

University of Technology. Laser & Optoelectronics Engineering Department. C++ Lab. University of Technology Laser & Optoelectronics Engineering Department C++ Lab. Second week Variables Data Types. The usefulness of the "Hello World" programs shown in the previous section is quite questionable.

More information

IX. Binary Trees (Chapter 10)

IX. Binary Trees (Chapter 10) IX. Binary Trees (Chapter 10) -1- A. Introduction: Searching a linked list. 1. Linear Search /* To linear search a list for a particular Item */ 1. Set Loc = 0; 2. Repeat the following: a. If Loc >= length

More information

Chapter 12: Searching: Binary Trees and Hash Tables. Exercises 12.1

Chapter 12: Searching: Binary Trees and Hash Tables. Exercises 12.1 Chapter 12: Searching: Binary Trees and Hash Tables Exercises 12.1 1. 4, 6 2. 4, 1, 2, 3 3. 4, 6, 5 4. 4, 1, 0 5. 4, 6, 7, 8 6. template linearsearch(elementtype x[], ElementType

More information

Object Oriented Programming COP3330 / CGS5409

Object Oriented Programming COP3330 / CGS5409 Object Oriented Programming COP3330 / CGS5409 Intro to Data Structures Vectors Linked Lists Queues Stacks C++ has some built-in methods of storing compound data in useful ways, like arrays and structs.

More information

1c) (iv) and (v) OR (v) only (hindsight showed that the question was more ambiguous than intended)

1c) (iv) and (v) OR (v) only (hindsight showed that the question was more ambiguous than intended) Answers to 2008/2009 G52CFJ exam Below are the answers to last year s exam, so that you can check how you did. In many cases I have given an example answer and an idea of what elements we would look for.

More information

Chapter 9 STACK, QUEUE

Chapter 9 STACK, QUEUE Chapter 9 STACK, QUEUE 1 LIFO: Last In, First Out. Stacks Restricted form of list: Insert and remove only at front of list. Notation: Insert: PUSH Remove: POP The accessible element is called TOP. Stack

More information

Have examined process Creating program Have developed program Written in C Source code

Have examined process Creating program Have developed program Written in C Source code Preprocessing, Compiling, Assembling, and Linking Introduction In this lesson will examine Architecture of C program Introduce C preprocessor and preprocessor directives How to use preprocessor s directives

More information

Amyuni PDF Creator for ActiveX

Amyuni PDF Creator for ActiveX Amyuni PDF Creator for ActiveX For PDF and XPS Version 4.5 Professional Quick Start Guide for Developers Updated October 2010 AMYUNI Consultants AMYUNI Technologies www.amyuni.com Contents Legal Information...

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2017 Lecture 6a Andrew Tolmach Portland State University 1994-2017 Iteration into Recursion Any iteration can be written as a recursion, e.g. while (c) {e Scala is equivalent

More information

libknx Generated by Doxygen Wed Aug :37:55

libknx Generated by Doxygen Wed Aug :37:55 libknx Generated by Doxygen 1.8.1.2 Wed Aug 7 2013 01:37:55 Contents 1 KNX interface library 1 2 Namespace Index 3 2.1 Namespace List............................................ 3 3 Class Index 5 3.1

More information

You must print this PDF and write your answers neatly by hand. You should hand in the assignment before recitation begins.

You must print this PDF and write your answers neatly by hand. You should hand in the assignment before recitation begins. 15-122 Homework 4 Page 1 of 13 15-122 : Principles of Imperative Computation, Summer 1 2014 Written Homework 4 Due: Thursday, June 12 before recitation Name: Andrew ID: Recitation: In this assignment,

More information

Mechanics. Chapter 3. Context Relativity

Mechanics. Chapter 3. Context Relativity ewald03.qxd 2/14/01 10:14 AM Page 83 Chapter 3 Mechanics Atoms are complicated things, and the atoms of COM+ are no exception. This is particularly true of context, the mechanics of which are more complex

More information

UNDEFINED BEHAVIOR IS AWESOME

UNDEFINED BEHAVIOR IS AWESOME UNDEFINED BEHAVIOR IS AWESOME Piotr Padlewski piotr.padlewski@gmail.com, @PiotrPadlewski ABOUT MYSELF Currently working in IIIT developing C++ tooling like clang-tidy and studying on University of Warsaw.

More information

Common Misunderstandings from Exam 1 Material

Common Misunderstandings from Exam 1 Material Common Misunderstandings from Exam 1 Material Kyle Dewey Stack and Heap Allocation with Pointers char c = c ; char* p1 = malloc(sizeof(char)); char** p2 = &p1; Where is c allocated? Where is p1 itself

More information

Cranking Policies Up. Andrei Alexandrescu. c 2009 Andrei Alexandrescu 1 / 45

Cranking Policies Up. Andrei Alexandrescu. c 2009 Andrei Alexandrescu 1 / 45 Cranking Policies Up Andrei Alexandrescu c 2009 Andrei Alexandrescu 1 / 45 Conclusions Eight years later, systematic design automation using policies is still elusive In spite of all the snazzy features

More information

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above P.G.TRB - COMPUTER SCIENCE Total Marks : 50 Time : 30 Minutes 1. C was primarily developed as a a)systems programming language b) general purpose language c) data processing language d) none of the above

More information

Containers: Stack. The Stack ADT. The Stack ADT. The Stack ADT

Containers: Stack. The Stack ADT. The Stack ADT. The Stack ADT Containers: Stack The Stack ADT A stack is a list of objects in which insertions and deletions can only be performed at the top of the list. Also known as LIFO Last In, First Out) push insert an element

More information

A Proposal to Add a Const-Propagating Wrapper to the Standard Library

A Proposal to Add a Const-Propagating Wrapper to the Standard Library Doc number: N4057 Revises: N3973 Date: 2014-07-02 Project: Programming Language C++, Library Evolution Working Group Reply-to: Jonathan Coe Robert Mill A Proposal

More information

COMP6771 Advanced C++ Programming

COMP6771 Advanced C++ Programming 1 COMP6771 Advanced C++ Programming Week 11 Object Oriented Programming 2016 www.cse.unsw.edu.au/ cs6771 2 Covariants and Contravariants Let us assume that Class B is a subtype of class A. Covariants:

More information

Type checking of statements We change the start rule from P D ; E to P D ; S and add the following rules for statements: S id := E

Type checking of statements We change the start rule from P D ; E to P D ; S and add the following rules for statements: S id := E Type checking of statements We change the start rule from P D ; E to P D ; S and add the following rules for statements: S id := E if E then S while E do S S ; S Type checking of statements The purpose

More information

Containers: Stack. Jordi Cortadella and Jordi Petit Department of Computer Science

Containers: Stack. Jordi Cortadella and Jordi Petit Department of Computer Science Containers: Stack Jordi Cortadella and Jordi Petit Department of Computer Science The Stack ADT A stack is a list of objects in which insertions and deletions can only be performed at the top of the list.

More information