RCB hangs on OS question when creating a buildspec

Size: px
Start display at page:

Download "RCB hangs on OS question when creating a buildspec"

Transcription

1 RCB hangs on OS question when creating a buildspec Problem Building Essential Tools Module, version 7.6.0, from SourcePro Core version fails to compile with any patched version of the IBM Visual Age compiler. The follow errors occur when trying to compile: xlc -q64 -D_RWCONFIG=11d -I./../../../include -I./../../.. -I.. -I. -D_RWBUILD_tls -g -qsuppress= c../btree.cpp "./../../../rw/tools/cstring.h", line : (S) "std" cannot be declared because its name has already been used. "./../../../rw/tools/cstring.h", line : (I) The name "std" is used on line 225 of "./../../../rw/tools/cstring.h". "../btree.cpp", line 45.1: (S) The call does not match any parameter list for "rwaddtofactory". "./../../../rw/collect.h", line 54.41: (I) "rwaddtofactory(rwcollectable *(*)(), RWClassID)" is not a viable "../btree.cpp", line 45.1: (I) The wrong number of arguments have been specified for "rwaddtofactory(rwcollectable *(*) (), RWClassID)". "./../../../rw/collect.h", line 58.41: (I) "rwaddtofactory(rwcollectable *(*)(), RWClassID, RWStringID)" is not a viable "../btree.cpp", line 45.1: (I) A parameter of type "RWStringID" cannot be initialized with an expression of type "const char [8]". "../btree.cpp", line 45.1: (I) This use of undefined class "RWStringID" is not valid. "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/tools/cstring.h", line : (S) The call does not match any parameter list for "operator[]". "./../../../rw/tools/cstring.h", line : (I) "builtin operator[](const char *, long)" is not a viable "./../../../rw/stringid.h", line : (S) The call does not match any parameter list for "operator==". "./../../../rw/tools/cstring.h", line : (I) "operator==(const RWCString &, const char *)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const char *" cannot be initialized with an expression of type "const RWCString". "./../../../rw/tools/cstring.h", line : (I) "operator==(const char *, const RWCString &)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const char *" cannot be initialized with an expression of type "const RWCString". "./../../../rw/tools/cstring.h", line : (I) "operator==(const RWCString &, const string &)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const std::basic_string<char,std::char_traits<char>,std::allocator<char> > &" cannot be initialized with an expression of type "const RWCString". "./../../../rw/tools/cstring.h", line : (I) "operator==(const string &, const RWCString &)" is not a viable 1

2 "./../../../rw/stringid.h", line : (I) A parameter of type "const std::basic_string<char,std::char_traits<char>,std::allocator<char> > &" cannot be initialized with an expression of type "const RWCString". "./../../../rw/tools/cstring.h", line : (I) "operator==(const RWCSubString &, const RWCSubString &)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const RWCSubString &" cannot be initialized with an "./../../../rw/tools/cstring.h", line : (I) "operator==(const RWCSubString &, const RWCConstSubString &)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const RWCSubString &" cannot be initialized with an "./../../../rw/tools/cstring.h", line : (I) "operator==(const RWCSubString &, const char *)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const RWCSubString &" cannot be initialized with an "./../../../rw/tools/cstring.h", line : (I) "operator==(const RWCSubString &, const RWCString &)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const RWCSubString &" cannot be initialized with an "./../../../rw/tools/cstring.h", line : (I) "operator==(const RWCString &, const RWCSubString &)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const RWCSubString &" cannot be initialized with an "./../../../rw/tools/cstring.h", line : (I) "operator==(const char *, const RWCSubString &)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const char *" cannot be initialized with an expression of type "const RWCString". "./../../../rw/tools/cstring.h", line : (I) "operator==(const RWCConstSubString &, const RWCConstSubString &)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const RWCConstSubString &" cannot be initialized with an "./../../../rw/tools/cstring.h", line : (I) "operator==(const RWCConstSubString &, const char *)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const RWCConstSubString &" cannot be initialized with an "./../../../rw/tools/cstring.h", line : (I) "operator==(const RWCConstSubString &, const RWCString &)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const RWCConstSubString &" cannot be initialized with an "./../../../rw/tools/cstring.h", line : (I) "operator==(const RWCConstSubString &, const RWCSubString &)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const RWCConstSubString &" cannot be initialized with an "./../../../rw/tools/cstring.h", line : (I) "operator==(const RWCString &, const RWCConstSubString &)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const RWCConstSubString &" cannot be initialized with an "./../../../rw/tools/cstring.h", line : (I) "operator==(const char *, const RWCConstSubString &)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const char *" cannot be initialized with an expression of type "const RWCString". "./../../../rw/stringid.h", line : (I) "operator==(const RWStringID &, const RWStringID &)" is not a viable "./../../../rw/stringid.h", line : (I) A parameter of type "const RWStringID &" cannot be initialized with an expression of type "const RWCString". "./../../../rw/stringid.h", line : (I) "builtin operator==(const char *, const char *)" is not a viable "./../../../rw/collect.h", line : (S) A parameter of type "RWStringID" cannot be initialized with an expression of type "const RWStringID". "./../../../rw/collect.h", line : (I) This use of undefined class "RWStringID" is not valid. "./../../../rw/collect.h", line : (I) The error occurred while converting to parameter 1 of "rwgetclassid(rwstringid)". make: The error code from the last command is 1. Stop. Cause The patched Visual Age compiler has a problem with regards to the namespace. If you reference a namespace in the body of a class AND the class has a member function that is the same name as the namespace, the compiler's parser fails. Here is a test case that demonstrates the problem: // namespace_test.cpp namespace A { class foo; 2

3 struct B { B(A::foo&); void A(); ; The Error: "namespace_test.cpp", line 12.8: (S) "A" cannot be declared because its name has already been used. "namespace_test.cpp", line 10.5: (I) The name "A" is used on line 10 of "namespace_test.cpp". Action Using the example above, if you use a typedef for "A::foo", the problem goes away. e.g. namespace A { class foo; typedef A::foo m; struct B { B(m&); void A(); ; WORKAROUND DESCRIPTION: This workaround has NOT been certified, and is intended as a temporary workaround only. In files that were affected by the compiler problem, I created a temporary namespace that brought in symbol names from the std namespace (I called it RWstandard). Then for the scope of the header (and that only), I redefined the macro RW_SL_STD to expand to use RWstandard:: as its prefix, instead of std::, RW_SL_STD was then restored to its original definition at the end of the header file. This gave the compiler a namespace of a different name than the member function (which of course couldn't be changed), and so it was able to parse it successfully. Below are the files that are affected You can download rwvafix.tar, which contains all the affected files. Untar this from the rw_buildspace/rw directory. rw/compiler.h - rw/tools/cstring.h - rw/tools/wstring.h - rw/tpdeque.h rw/tpdlist.h - rw/tphasht.h - rw/tphdict.h - rw/tphmmap.h - rw/tphset.h rw/tpmap.h - rw/tpmmap.h - rw/tpmset.h - rw/tpordvec.h - rw/tpset.h rw/tpslist.h - rw/tpsrtdli.h - rw/tpsrtvec.h - rw/tvdeque.h - rw/tvdlist.h rw/tvhasht.h - rw/tvhdict.h - rw/tvhmmap.h - rw/tvhset.h - rw/tvmap.h rw/tvmmap.h - rw/tvmset.h - rw/tvordvec.h - rw/tvset.h - rw/tvslist.h rw/tvsrtdli.h - rw/tvsrtvec.h rw/compiler.h line 107 # if IBMCPP = 502 # define RW_BROKEN_NAMESPACE_SCOPING 1 # endif rw/tools/cstring.h line 48 using std::string; 3

4 line 1759 rw/tools/wstring.h using std::wstring; line 1845 rw/tpdeque.h line 46 using std::deque; line 150 rw/tpdlist.h using std::list; using std::advance; line 298 rw/tphasht.h line 50 line 312 4

5 rw/tphdict.h line 47 line 270 rw/tphmmap.h line 45 line 255 rw/tphset.h line 46 line 288 rw/tpmap.h using std::map; using std::multimap; line 273 5

6 rw/tpmmap.h using std::map; using std::multimap; line 274 rw/tpmset.h line 41 using std::multiset; line 241 rw/tpordvec.h line 41 using std::vector; line 185 rw/tpset.h using std::set; line 236 6

7 rw/tpslist.h line 44 line 229 rw/tpsrtdli.h line 48 using std::list; using std::advance; line 236 rw/tpsrtvec.h line 48 using std::vector; line 206 rw/tvdeque.h line 41 using std::deque; line 174 rw/tvdlist.h 7

8 using std::list; using std::advance; line 259 rw/tvhasht.h line 51 line 265 rw/tvhdict.h line 51 line 253 rw/tvhmmap.h line 44 line 227 rw/tvhset.h line 52 8

9 line 296 rw/tvmap.h using std::map; using std::multimap; line 258 rw/tvmmap.h using std::map; using std::multimap; line 255 rw/tvmset.h using std::multiset; line 235 rw/tvordvec.h line 45 using std::vector; 9

10 line 187 rw/tvset.h line 43 using std::set; line 219 rw/tvslist.h line 43 line 223 rw/tvsrtdli.h line 47 using std::list; using std::advance; line 239 rw/tvsrtvec.h line 51 using std::vector; 10

11 line 202 Article ID: 1189 Last updated: 07 Feb, 2008 Updated by: Dean J. Revision: 1 SourcePro -> Core -> Essential Tools Module -> RCB hangs on OS question when creating a buildspec 11

GEA 2017, Week 4. February 21, 2017

GEA 2017, Week 4. February 21, 2017 GEA 2017, Week 4 February 21, 2017 1. Problem 1 After debugging the program through GDB, we can see that an allocated memory buffer has been freed twice. At the time foo(...) gets called in the main function,

More information

C++ Coding Standards and Practices. Tim Beaudet March 23rd 2015

C++ Coding Standards and Practices. Tim Beaudet March 23rd 2015 C++ Coding Standards and Practices Tim Beaudet (timbeaudet@yahoo.com) March 23rd 2015 Table of Contents Table of contents About these standards Project Source Control Build Automation Const Correctness

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

Lecture 7. Log into Linux New documents posted to course webpage

Lecture 7. Log into Linux New documents posted to course webpage Lecture 7 Log into Linux New documents posted to course webpage Coding style guideline; part of project grade is following this Homework 4, due on Monday; this is a written assignment Project 1, due next

More information

COMP322 - Introduction to C++ Lecture 02 - Basics of C++

COMP322 - Introduction to C++ Lecture 02 - Basics of C++ COMP322 - Introduction to C++ Lecture 02 - Basics of C++ School of Computer Science 16 January 2012 C++ basics - Arithmetic operators Where possible, C++ will automatically convert among the basic types.

More information

COMP322 - Introduction to C++

COMP322 - Introduction to C++ COMP322 - Introduction to C++ Winter 2011 Lecture 2 - Language Basics Milena Scaccia School of Computer Science McGill University January 11, 2011 Course Web Tools Announcements, Lecture Notes, Assignments

More information

Outline. 1 Function calls and parameter passing. 2 Pointers, arrays, and references. 5 Declarations, scope, and lifetimes 6 I/O

Outline. 1 Function calls and parameter passing. 2 Pointers, arrays, and references. 5 Declarations, scope, and lifetimes 6 I/O Outline EDAF30 Programming in C++ 2. Introduction. More on function calls and types. Sven Gestegård Robertz Computer Science, LTH 2018 1 Function calls and parameter passing 2 Pointers, arrays, and references

More information

Towards a Transaction-safe C++ Standard Library: std::list

Towards a Transaction-safe C++ Standard Library: std::list Document Number: N3862 Date: 2014-01-20 Authors: Justin Gottschlich, justin.gottschlich@intel.com Michael Spear, spear@cse.lehigh.edu Michael Wong, michaelw@ca.ibm.com with other members of the transactional

More information

CSCI 123 Introduction to Programming Concepts in C++

CSCI 123 Introduction to Programming Concepts in C++ CSCI 123 Introduction to Programming Concepts in C++ Brad Rippe Brad Rippe More Classes and Dynamic Arrays Overview 11.4 Classes and Dynamic Arrays Constructors, Destructors, Copy Constructors Separation

More information

Tutorial 6. Y. Bernat. Object Oriented Programming 2, Spring Y. Bernat Tutorial 6

Tutorial 6. Y. Bernat. Object Oriented Programming 2, Spring Y. Bernat Tutorial 6 Tutorial 6 Y. Bernat Object Oriented Programming 2, Spring 2016 Outline Part I Today's Topics 1 Intro!= C++ Standard Library Standard Template Library 3 ingerdience/concepts Set of data structures that

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College November 9, 2016 Outline Outline 1 Chapter 9: C++ Classes Outline Chapter 9: C++ Classes 1 Chapter 9: C++ Classes Class Syntax

More information

2.9 DCL58-CPP. Do not modify the standard namespaces

2.9 DCL58-CPP. Do not modify the standard namespaces 2.9 DCL58-CPP. Do not modify the standard namespaces Namespaces introduce new declarative regions for declarations, reducing the likelihood of conflicting identifiers with other declarative regions. One

More information

C++ C and C++ C++ fundamental types. C++ enumeration. To quote Bjarne Stroustrup: 5. Overloading Namespaces Classes

C++ C and C++ C++ fundamental types. C++ enumeration. To quote Bjarne Stroustrup: 5. Overloading Namespaces Classes C++ C and C++ 5. Overloading Namespaces Classes Alastair R. Beresford University of Cambridge Lent Term 2007 To quote Bjarne Stroustrup: C++ is a general-purpose programming language with a bias towards

More information

Programmazione. Prof. Marco Bertini

Programmazione. Prof. Marco Bertini Programmazione Prof. Marco Bertini marco.bertini@unifi.it http://www.micc.unifi.it/bertini/ Hello world : a review Some differences between C and C++ Let s review some differences between C and C++ looking

More information

Intermediate Programming, Spring 2017*

Intermediate Programming, Spring 2017* 600.120 Intermediate Programming, Spring 2017* Misha Kazhdan *Much of the code in these examples is not commented because it would otherwise not fit on the slides. This is bad coding practice in general

More information

Rule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead.

Rule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead. Chapter 9: Rules Chapter 1:Style and Program Organization Rule 1-1: Organize programs for readability, just as you would expect an author to organize a book. Rule 1-2: Divide each module up into a public

More information

Instantiation of Template class

Instantiation of Template class Class Templates Templates are like advanced macros. They are useful for building new classes that depend on already existing user defined classes or built-in types. Example: stack of int or stack of double

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

More information

Overload Resolution. Ansel Sermersheim & Barbara Geller ACCU / C++ June 2018

Overload Resolution. Ansel Sermersheim & Barbara Geller ACCU / C++ June 2018 Ansel Sermersheim & Barbara Geller ACCU / C++ June 2018 1 Introduction Definition of Function Overloading Determining which Overload to call How Overload Resolution Works Standard Conversion Sequences

More information

Prefix Trees Tables in Practice

Prefix Trees Tables in Practice Prefix Trees CS 311 Data Structures and Algorithms Lecture Slides Friday, December 7, 2007 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks CHAPPELLG@member.ams.org 2005

More information

04-19 Discussion Notes

04-19 Discussion Notes 04-19 Discussion Notes PIC 10B Spring 2018 1 Constructors and Destructors 1.1 Copy Constructor The copy constructor should copy data. However, it s not this simple, and we need to make a distinction here

More information

EL2310 Scientific Programming

EL2310 Scientific Programming (pronobis@kth.se) Overview Overview Wrap Up Introduction to Object Oriented Paradigm More on and Members Operator Overloading Last time Intro to C++ Differences between C and C++ Intro to OOP Today Object

More information

Programming in C and C++

Programming in C and C++ Programming in C and C++ 5. C++: Overloading, Namespaces, and Classes Dr. Neel Krishnaswami University of Cambridge (based on notes from and with thanks to Anil Madhavapeddy, Alan Mycroft, Alastair Beresford

More information

Overload Resolution. Ansel Sermersheim & Barbara Geller Amsterdam C++ Group March 2019

Overload Resolution. Ansel Sermersheim & Barbara Geller Amsterdam C++ Group March 2019 Ansel Sermersheim & Barbara Geller Amsterdam C++ Group March 2019 1 Introduction Prologue Definition of Function Overloading Determining which Overload to call How Works Standard Conversion Sequences Examples

More information

BSON C++ API. Version by Sans Pareil Technologies, Inc. Generated by Doxygen Thu Feb :32:39

BSON C++ API. Version by Sans Pareil Technologies, Inc. Generated by Doxygen Thu Feb :32:39 BSON C++ API Version 2.5.1 by Sans Pareil Technologies, Inc. Generated by Doxygen 1.8.3 Thu Feb 28 2013 10:32:39 Contents 1 BSON C++ API Documentation 1 1.1 Contents................................................

More information

Class and Function Templates

Class and Function Templates Class and Function 1 Motivation for One Way to Look at... Example: Queue of some type Foo C++ What can a parameter be used for? Instantiating a Template Usage of Compiler view of templates... Implementing

More information

Motivation for Templates. Class and Function Templates. One Way to Look at Templates...

Motivation for Templates. Class and Function Templates. One Way to Look at Templates... Class and Function 1 Motivation for 2 Motivation for One Way to Look at... Example: Queue of some type Foo C++ What can a parameter be used for? Instantiating a Template Usage of Compiler view of templates...

More information

C++ Constructor Insanity

C++ Constructor Insanity C++ Constructor Insanity CSE 333 Spring 2018 Instructor: Justin Hsia Teaching Assistants: Danny Allen Dennis Shao Eddie Huang Kevin Bi Jack Xu Matthew Neldam Michael Poulain Renshu Gu Robby Marver Waylon

More information

Shahram Rahatlou. Computing Methods in Physics. Overloading Operators friend functions static data and methods

Shahram Rahatlou. Computing Methods in Physics. Overloading Operators friend functions static data and methods Overloading Operators friend functions static data and methods Shahram Rahatlou Computing Methods in Physics http://www.roma1.infn.it/people/rahatlou/cmp/ Anno Accademico 2018/19 Today s Lecture Overloading

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

More information

Control flow and string example. C and C++ Functions. Function type-system nasties. 2. Functions Preprocessor. Alastair R. Beresford.

Control flow and string example. C and C++ Functions. Function type-system nasties. 2. Functions Preprocessor. Alastair R. Beresford. Control flow and string example C and C++ 2. Functions Preprocessor Alastair R. Beresford University of Cambridge Lent Term 2007 #include char s[]="university of Cambridge Computer Laboratory";

More information

C Programming Review CSC 4320/6320

C Programming Review CSC 4320/6320 C Programming Review CSC 4320/6320 Overview Introduction C program Structure Keywords & C Types Input & Output Arrays Functions Pointers Structures LinkedList Dynamic Memory Allocation Macro Compile &

More information

Slide Set 6. for ENCM 339 Fall 2017 Section 01. Steve Norman, PhD, PEng

Slide Set 6. for ENCM 339 Fall 2017 Section 01. Steve Norman, PhD, PEng Slide Set 6 for ENCM 339 Fall 2017 Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary October 2017 ENCM 339 Fall 2017 Section 01 Slide

More information

Lab 2: ADT Design & Implementation

Lab 2: ADT Design & Implementation Lab 2: ADT Design & Implementation By Dr. Yingwu Zhu, Seattle University 1. Goals In this lab, you are required to use a dynamic array to design and implement an ADT SortedList that maintains a sorted

More information

CSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community

CSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community CSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu History and Evolution of Programming Languages 1. Explain the relationship between machine

More information

CAAM 420 Fall 2012 Lecture 29. Duncan Eddy

CAAM 420 Fall 2012 Lecture 29. Duncan Eddy CAAM 420 Fall 2012 Lecture 29 Duncan Eddy November 7, 2012 Table of Contents 1 Templating in C++ 3 1.1 Motivation.............................................. 3 1.2 Templating Functions........................................

More information

Run Time Environment

Run Time Environment CS 403 Compiler Construction Lecture 12 Run Time Environment and Management [Based on Chapter 7 of Aho2] 1 Run Time Environment From Lecture 1 to 11, we have seen many jobs that are done by a compiler.

More information

QUIZ. What are 3 differences between C and C++ const variables?

QUIZ. What are 3 differences between C and C++ const variables? QUIZ What are 3 differences between C and C++ const variables? Solution QUIZ Source: http://stackoverflow.com/questions/17349387/scope-of-macros-in-c Solution The C/C++ preprocessor substitutes mechanically,

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

use static size for this buffer

use static size for this buffer Software Design (C++) 4. Templates and standard library (STL) Juha Vihavainen University of Helsinki Overview Introduction to templates (generics) std::vector again templates: specialization by code generation

More information

Improve your C++! John Richardson. Lab Study Meeting 2013

Improve your C++! John Richardson. Lab Study Meeting 2013 Improve your C++! John Richardson Lab Study Meeting 2013 Objectives How do I use the standard library correctly? What is C++11? Should I use it? Skills for debugging...? What kind of profiling is possible

More information

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14 C introduction Variables Variables 1 / 14 Contents Variables Data types Variable I/O Variables 2 / 14 Usage Declaration: t y p e i d e n t i f i e r ; Assignment: i d e n t i f i e r = v a l u e ; Definition

More information

Object Oriented Design

Object Oriented Design Object Oriented Design Lecture 3: Introduction to C++ (Continue) Examples using declarations that eliminate the need to repeat the std:: prefix 1 Examples using namespace std; enables a program to use

More information

2.4 Structuring programs

2.4 Structuring programs 2.4 Structuring programs While theoretically a program could be written as one big expression, in reality we want some structure so that l The programmer has it easier to read the program l A compiler

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

GCC : From 2.95 to 3.2

GCC : From 2.95 to 3.2 GCC : From 2.95 to 3.2 Topics Simple changes name of standard include files, std::endl, iostream, throw statements, vector iterators More complicated changes string streams, parameterized macros, hash_map

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

Fundamentals of Programming. Lecture 19 Hamed Rasifard

Fundamentals of Programming. Lecture 19 Hamed Rasifard Fundamentals of Programming Lecture 19 Hamed Rasifard 1 Outline C++ Object-Oriented Programming Class 2 C++ C++ began as an expanded version of C. C++ improves on many of C s features and provides object-oriented-programming

More information

Shahram Rahatlou. Static Data Members Enumeration std::pair, std::vector, std::map. Computing Methods in Physics

Shahram Rahatlou. Static Data Members Enumeration std::pair, std::vector, std::map. Computing Methods in Physics Static Data Members Enumeration std::pair, std::vector, std::map Shahram Rahatlou Computing Methods in Physics http://www.roma1.infn.it/people/rahatlou/cmp/ Anno Accademico 2018/19 Class Datum Use static

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

Procedures, Parameters, Values and Variables. Steven R. Bagley

Procedures, Parameters, Values and Variables. Steven R. Bagley Procedures, Parameters, Values and Variables Steven R. Bagley Recap A Program is a sequence of statements (instructions) Statements executed one-by-one in order Unless it is changed by the programmer e.g.

More information

Lab 1: First Steps in C++ - Eclipse

Lab 1: First Steps in C++ - Eclipse Lab 1: First Steps in C++ - Eclipse Step Zero: Select workspace 1. Upon launching eclipse, we are ask to chose a workspace: 2. We select a new workspace directory (e.g., C:\Courses ): 3. We accept the

More information

Slide Set 5. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Slide Set 5. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary Slide Set 5 for ENCM 339 Fall 2016 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary October 2016 ENCM 339 Fall 2016 Slide Set 5 slide 2/32

More information

How the Adapters and Binders Work

How the Adapters and Binders Work What code gets generated when we write #include #include #include using namespace std;... vector v; void foo(char, int); How the Adapters and Binders Work David Kieras

More information

Elevate your Code to Modern C++ with Automated Tooling. Peter Sommerlad

Elevate your Code to Modern C++ with Automated Tooling. Peter Sommerlad Elevate your Code to Modern C++ with Automated Tooling Peter Sommerlad Simple C++ Less Code == More Software Know your language and its (modern) idioms Don t be afraid of STL or templates Start small.

More information

Optimizing C++/Print Version

Optimizing C++/Print Version 1 of 85 05/02/2012 03:38 PM Optimizing C++/Print Version Optimizing C++/Cover 2 of 85 05/02/2012 03:38 PM Introduction One of the main reason for preferring C++ over simpler, higher-level programming languages

More information

Overview. 1. Expression Value Categories 2. Rvalue References 3. Templates 4. Miscellaneous Hilarity 2/43

Overview. 1. Expression Value Categories 2. Rvalue References 3. Templates 4. Miscellaneous Hilarity 2/43 Advanced C++ 1/43 Overview 1. Expression Value Categories 2. Rvalue References 3. Templates 4. Miscellaneous Hilarity 2/43 1. Expression Value Categories These are not the droids you re looking for ~Obi-wan

More information

CS93SI Handout 04 Spring 2006 Apr Review Answers

CS93SI Handout 04 Spring 2006 Apr Review Answers CS93SI Handout 04 Spring 2006 Apr 6 2006 Review Answers I promised answers to these questions, so here they are. I'll probably readdress the most important of these over and over again, so it's not terribly

More information

Test Driven Development for Eclipse CDT

Test Driven Development for Eclipse CDT bachelor thesis Test Driven Development for Eclipse CDT Thomas Kallenberg, Martin Schwab June 17, 2011 Supervisor: Prof. Peter Sommerlad In 2006, Prof. Peter Sommerlad introduced the CUTE unit testing

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

CS3215. Outline: 1. Introduction 2. C++ language features 3. C++ program organization

CS3215. Outline: 1. Introduction 2. C++ language features 3. C++ program organization CS3215 C++ briefing Outline: 1. Introduction 2. C++ language features 3. C++ program organization CS3215 C++ briefing 1 C++ versus Java Java is safer and simpler than C++ C++ is faster, more powerful than

More information

Compiler Theory. (GCC the GNU Compiler Collection) Sandro Spina 2009

Compiler Theory. (GCC the GNU Compiler Collection) Sandro Spina 2009 Compiler Theory (GCC the GNU Compiler Collection) Sandro Spina 2009 GCC Probably the most used compiler. Not only a native compiler but it can also cross-compile any program, producing executables for

More information

Comp151. Generic Programming: Container Classes

Comp151. Generic Programming: Container Classes Comp151 Generic Programming: Container Classes Container Classes Container classes are a typical use for class templates, since we need container classes for objects of many different types, and the types

More information

C and C++ 2. Functions Preprocessor. Alan Mycroft

C and C++ 2. Functions Preprocessor. Alan Mycroft C and C++ 2. Functions Preprocessor Alan Mycroft University of Cambridge (heavily based on previous years notes thanks to Alastair Beresford and Andrew Moore) Michaelmas Term 2013 2014 1 / 1 Functions

More information

Introduction & Review

Introduction & Review CPSC 250 Data Structures Introduction & Review Dr. Yingwu Zhu What to learn? ADT design & implementation using C++ class Algorithm efficiency analysis Big-O ADTs: Binary search trees, AVL trees, Heaps,

More information

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University Fundamental Data Types CSE 130: Introduction to Programming in C Stony Brook University Program Organization in C The C System C consists of several parts: The C language The preprocessor The compiler

More information

CIS 190: C/C++ Programming. Classes in C++

CIS 190: C/C++ Programming. Classes in C++ CIS 190: C/C++ Programming Classes in C++ Outline Header Protection Functions in C++ Procedural Programming vs OOP Classes Access Constructors Headers in C++ done same way as in C including user.h files:

More information

CAAM 420 Daily Note. Scriber: Qijia Jiang. Date: Oct.16. Project 3 Due Wed 23.Oct. Two parts: debug code and library exercise.

CAAM 420 Daily Note. Scriber: Qijia Jiang. Date: Oct.16. Project 3 Due Wed 23.Oct. Two parts: debug code and library exercise. CAAM 420 Daily Note Scriber: Qijia Jiang Date: Oct.16 1 Announcement Project 3 Due Wed 23.Oct. Two parts: debug code and library exercise. 2 Make Convention Make syntax for library directories and library

More information

IBM Rational Rhapsody TestConductor Add On. Code Coverage Limitations

IBM Rational Rhapsody TestConductor Add On. Code Coverage Limitations IBM Rational Rhapsody TestConductor Add On Code Coverage Limitations 1 Rhapsody IBM Rational Rhapsody TestConductor Add On Code Coverage Limitations Release 2.7.1 2 License Agreement No part of this publication

More information

Fundamentals of Programming Session 24

Fundamentals of Programming Session 24 Fundamentals of Programming Session 24 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2014 These slides have been created using Deitel s slides Sharif University of Technology Outlines

More information

EL2310 Scientific Programming

EL2310 Scientific Programming Lecture 14: Object Oriented Programming in C++ (fpokorny@kth.se) Overview Overview Lecture 14: Object Oriented Programming in C++ Wrap Up Introduction to Object Oriented Paradigm Classes More on Classes

More information

AIMS Embedded Systems Programming MT 2017

AIMS Embedded Systems Programming MT 2017 AIMS Embedded Systems Programming MT 2017 Object-Oriented Programming with C++ Daniel Kroening University of Oxford, Computer Science Department Version 1.0, 2014 Outline Classes and Objects Constructors

More information

Modern C++ for Computer Vision and Image Processing. Igor Bogoslavskyi

Modern C++ for Computer Vision and Image Processing. Igor Bogoslavskyi Modern C++ for Computer Vision and Image Processing Igor Bogoslavskyi Outline Move semantics Classes Operator overloading Making your class copyable Making your class movable Rule of all or nothing Inheritance

More information

struct Buffer { Buffer(int s) { buf = new char[s]; } ~Buffer() { delete [] buf; } char *buf; };

struct Buffer { Buffer(int s) { buf = new char[s]; } ~Buffer() { delete [] buf; } char *buf; }; struct Buffer { Buffer(int s) { buf = new char[s]; ~Buffer() { delete [] buf; char *buf; ; struct FBuffer : public Buffer { FBuffer(int s) : Buffer(s) { f = fopen("file", "w"); ~FBuffer() { fclose(f);

More information

Midterm Review. PIC 10B Spring 2018

Midterm Review. PIC 10B Spring 2018 Midterm Review PIC 10B Spring 2018 Q1 What is size t and when should it be used? A1 size t is an unsigned integer type used for indexing containers and holding the size of a container. It is guarenteed

More information

Topics. Functions. Functions

Topics. Functions. Functions Topics Notes #8 Functions Chapter 6 1) How can we break up a program into smaller sections? 2) How can we pass information to and from functions? 3) Where can we put functions in our code? CMPT 125/128

More information

C-style casts Static and Dynamic Casts reinterpret cast const cast PVM. Casts

C-style casts Static and Dynamic Casts reinterpret cast const cast PVM. Casts PVM Casts Casting Casting: explicit type conversion Upcasting: casting to a supertype E.g. cast from Dog to Animal Downcasting: casting to a subtype E.g. cast from Animal to Dog Upcasts are always safe

More information

Binghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program

Binghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program Syntax What the Compiler needs to understand your program 1 Pre-Processing Any line that starts with # is a pre-processor directive Pre-processor consumes that entire line Possibly replacing it with other

More information

Structures, Unions Alignment, Padding, Bit Fields Access, Initialization Compound Literals Opaque Structures Summary. Structures

Structures, Unions Alignment, Padding, Bit Fields Access, Initialization Compound Literals Opaque Structures Summary. Structures Structures Proseminar C Grundlagen und Konzepte Michael Kuhn Research Group Scientific Computing Department of Informatics Faculty of Mathematics, Informatics und Natural Sciences University of Hamburg

More information

TDDD38 - Advanced programming in C++

TDDD38 - Advanced programming in C++ TDDD38 - Advanced programming in C++ STL II Christoffer Holm Department of Computer and information science 1 Iterators 2 Associative Containers 3 Container Adaptors 4 Lambda Functions 1 Iterators 2 Associative

More information

G52CPP C++ Programming Lecture 20

G52CPP C++ Programming Lecture 20 G52CPP C++ Programming Lecture 20 Dr Jason Atkin http://www.cs.nott.ac.uk/~jaa/cpp/ g52cpp.html 1 Wrapping up Slicing Problem Smart pointers More C++ things Exams 2 The slicing problem 3 Objects are not

More information

! Data is stored in variables. - Perhaps using arrays and structs. ! Program is a collection of functions that perform

! Data is stored in variables. - Perhaps using arrays and structs. ! Program is a collection of functions that perform Ch 13: Introduction to Classes 13.1 Procedural Programming! Data is stored in variables CS 2308 Fall 2012 Jill Seaman - Perhaps using arrays and structs.! Program is a collection of functions that perform

More information

Object Reference and Memory Allocation. Questions:

Object Reference and Memory Allocation. Questions: Object Reference and Memory Allocation Questions: 1 1. What is the difference between the following declarations? const T* p; T* const p = new T(..constructor args..); 2 2. Is the following C++ syntax

More information

Motivation for Templates

Motivation for Templates Motivation for You want both: a list of Location objects a list of MazeMonster objects 1 How can you accomplish this by writing one LinkedList class? state all the ways you can think of doing this state

More information

COMP6771 Advanced C++ Programming

COMP6771 Advanced C++ Programming 1. COMP6771 Advanced C++ Programming Week 7 Part One: Member Templates and 2016 www.cse.unsw.edu.au/ cs6771 2. Member Templates Consider this STL code: 1 #include 2 #include 3 #include

More information

Variant: Discriminated Union with Value Semantics

Variant: Discriminated Union with Value Semantics Variant: Discriminated Union with Value Semantics Document #: P0080 Date: 2015-07-28 Project: Programming Language C++ Library Evolution Group Reply-to: Michael Park Contents 1 Introduction

More information

Bruce Merry. IOI Training Dec 2013

Bruce Merry. IOI Training Dec 2013 IOI Training Dec 2013 Outline 1 2 3 Outline 1 2 3 You can check that something is true using assert: #include int main() { assert(1 == 2); } Output: test_assert: test_assert.cpp:4: int main():

More information

Classes and Operators. Ali Malik

Classes and Operators. Ali Malik Classes and Operators Ali Malik malikali@stanford.edu Game Plan Recap Classes II Operator Overloading Announcement Recap Objects We use objects all the time (string, vector etc.) Objects encapsulate behaviour

More information

The University of Nottingham

The University of Nottingham The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, AUTUMN SEMESTER 2008 2009 C/C++ for Java Programmers Time allowed TWO hours Candidates may complete the front cover of their answer

More information

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco

CS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco CS 326 Operating Systems C Programming Greg Benson Department of Computer Science University of San Francisco Why C? Fast (good optimizing compilers) Not too high-level (Java, Python, Lisp) Not too low-level

More information

MODERN AND LUCID C++ ADVANCED

MODERN AND LUCID C++ ADVANCED Informatik MODERN AND LUCID C++ ADVANCED for Professional Programmers Prof. Peter Sommerlad Thomas Corbat Director of IFS Research Assistant Rapperswil, FS 2016 LIBRARY API/ABI DESIGN PIMPL IDIOM HOURGLASS

More information

Classes. Christian Schumacher, Info1 D-MAVT 2013

Classes. Christian Schumacher, Info1 D-MAVT 2013 Classes Christian Schumacher, chschuma@inf.ethz.ch Info1 D-MAVT 2013 Object-Oriented Programming Defining and using classes Constructors & destructors Operators friend, this, const Example Student management

More information

COMP6771 Advanced C++ Programming

COMP6771 Advanced C++ Programming 1.. COMP6771 Advanced C++ Programming Week 3 Part Two: Classes - (cont.), Uniform Initialisation,, Type Conversions, Scope and Copy Control 2016 www.cse.unsw.edu.au/ cs6771 2.. Assignment 1: Fun With Collections

More information

Value categories. PRvalues. Lvalues

Value categories. PRvalues. Lvalues Value categories v5 Every C++14 expression belongs to exactly one of the following classifications, known as value categories: lvalue, xvalue, prvalue. There's an overlap between these, so a higher level

More information

Bash command shell language interpreter

Bash command shell language interpreter Principles of Programming Languages Bash command shell language interpreter Advanced seminar topic Louis Sugy & Baptiste Thémine Presentation on December 8th, 2017 Table of contents I. General information

More information

Symbols, Compilation Units, and Pre-Processing

Symbols, Compilation Units, and Pre-Processing Symbols, Compilation Units, and Pre-Processing Antonio Carzaniga Faculty of Informatics University of Lugano December 21, 2006 Outline Compilation process Symbols: compilation units and linking The C pre-processor

More information

Object-oriented Programming in C++

Object-oriented Programming in C++ Object-oriented Programming in C++ Working with C and C++ Wolfgang Eckhardt, Tobias Neckel March 23, 2015 Working with C and C++, March 23, 2015 1 Challenges of This Course Heterogeneity of the audience

More information

Machine Language Instructions Introduction. Instructions Words of a language understood by machine. Instruction set Vocabulary of the machine

Machine Language Instructions Introduction. Instructions Words of a language understood by machine. Instruction set Vocabulary of the machine Machine Language Instructions Introduction Instructions Words of a language understood by machine Instruction set Vocabulary of the machine Current goal: to relate a high level language to instruction

More information

Standard wording for a Transaction-safe C++ Standard Library std::list

Standard wording for a Transaction-safe C++ Standard Library std::list Document Number: N4000 Date: 2014-05-23 Authors: Michael Wong, michaelw@ca.ibm.com Jens Maurer, jens.maurer@gmx.net Michael Spear, spear@cse.lehigh.edu Justin Gottschlich, justin.gottschlich@intel.com

More information