C++ Programming HOW-TO

Total Page:16

File Type:pdf, Size:1020Kb

C++ Programming HOW-TO C++ Programming HOW−TO C++ Programming HOW−TO Table of Contents C++ Programming HOW−TO...........................................................................................................................1 Al Dev (Alavoor Vasudevan) alavoor@yahoo.com...............................................................................1 1. Introduction..........................................................................................................................................1 2. String Class Varieties ..........................................................................................................................1 3. Best C++ compilers for MS Windows 2000/NT/95/98/ME/XP .........................................................1 4. Download String .................................................................................................................................1 5. How Can I trust Al Dev's String Class ?? ...........................................................................................1 6. Usage of String class............................................................................................................................1 7. String.h file..........................................................................................................................................1 8. Renaming the String class....................................................................................................................2 9. File Class..............................................................................................................................................2 10. C++ Zap (Delete) function ................................................................................................................2 11. Pointers are problems ........................................................................................................................2 12. Usage of my_malloc and my_free ....................................................................................................2 13. Debug files.........................................................................................................................................2 14. Java like API......................................................................................................................................2 15. IDE tools for C++ .............................................................................................................................2 16. C++ Online Textbooks and Docs ......................................................................................................2 17. C++ Coding Standards.......................................................................................................................2 18. C++ Online Docs...............................................................................................................................2 19. Memory Tools....................................................................................................................................2 20. Related URLs.....................................................................................................................................2 21. C++ Scripting Languages..................................................................................................................2 22. Templates...........................................................................................................................................3 23. STL References .................................................................................................................................3 24. Threads in C++..................................................................................................................................3 25. C++ Utilities......................................................................................................................................3 26. Other Formats of this Document........................................................................................................3 27. Copyright...........................................................................................................................................3 28. Appendix A String Program Files ....................................................................................................3 1. Introduction..........................................................................................................................................3 1.1 C++ v/s Java.......................................................................................................................................4 1.2 Which one Ada95, "C", "C++" or Java ??.........................................................................................4 1.3 Problems facing the current C++ compilers......................................................................................5 1.4 COOP − C++ Object Oriented Programming−language...................................................................6 2. String Class Varieties .........................................................................................................................7 2.1 Multiple Inheritance − Sample Custom String class ........................................................................7 3. Best C++ compilers for MS Windows 2000/NT/95/98/ME/XP ........................................................8 4. Download String ................................................................................................................................9 5. How Can I trust Al Dev's String Class ?? ..........................................................................................9 6. Usage of String class............................................................................................................................9 6.1 Operators..........................................................................................................................................10 6.2 Functions..........................................................................................................................................11 7. String.h file........................................................................................................................................11 7.1 StringBuffer.h..................................................................................................................................17 7.2 StringTokenizer.h.............................................................................................................................18 8. Renaming the String class..................................................................................................................19 8.1 Case 1: Simple rename.....................................................................................................................19 i C++ Programming HOW−TO Table of Contents 8.2 Case 2: Resolve conflict...................................................................................................................19 9. File Class............................................................................................................................................20 10. C++ Zap (Delete) function .............................................................................................................20 11. Pointers are problems .....................................................................................................................21 12. Usage of my_malloc and my_free .................................................................................................22 12.1 Garbage Collector for C++ ..........................................................................................................24 13. Debug files.......................................................................................................................................24 14. Java like API....................................................................................................................................24 15. IDE tools for C++ ..........................................................................................................................24 16. C++ Online Textbooks and Docs ...................................................................................................25 17. C++ Coding Standards.....................................................................................................................25 18. C++ Online Docs.............................................................................................................................27 18.1 C++ Tutorials.................................................................................................................................28 18.2 Useful links....................................................................................................................................28 18.3 C++ Quick−Reference...................................................................................................................28 18.4 C++ Usenet Newsgroups...............................................................................................................28 19. Memory Tools..................................................................................................................................28 20. Related URLs...................................................................................................................................29
Recommended publications
  • Dynamic Object-Oriented Programming with Smalltalk
    Dynamic Object-Oriented Programming with Smalltalk 1. Introduction Prof. O. Nierstrasz Autumn Semester 2009 LECTURE TITLE What is surprising about Smalltalk > Everything is an object > Everything happens by sending messages > All the source code is there all the time > You can't lose code > You can change everything > You can change things without restarting the system > The Debugger is your Friend © Oscar Nierstrasz 2 ST — Introduction Why Smalltalk? > Pure object-oriented language and environment — “Everything is an object” > Origin of many innovations in OO development — RDD, IDE, MVC, XUnit … > Improves on many of its successors — Fully interactive and dynamic © Oscar Nierstrasz 1.3 ST — Introduction What is Smalltalk? > Pure OO language — Single inheritance — Dynamically typed > Language and environment — Guiding principle: “Everything is an Object” — Class browser, debugger, inspector, … — Mature class library and tools > Virtual machine — Objects exist in a persistent image [+ changes] — Incremental compilation © Oscar Nierstrasz 1.4 ST — Introduction Smalltalk vs. C++ vs. Java Smalltalk C++ Java Object model Pure Hybrid Hybrid Garbage collection Automatic Manual Automatic Inheritance Single Multiple Single Types Dynamic Static Static Reflection Fully reflective Introspection Introspection Semaphores, Some libraries Monitors Concurrency Monitors Categories, Namespaces Packages Modules namespaces © Oscar Nierstrasz 1.5 ST — Introduction Smalltalk: a State of Mind > Small and uniform language — Syntax fits on one sheet of paper >
    [Show full text]
  • Nested Class Modularity in Squeak/Smalltalk
    Springer, Nested Class Modularity in Squeak/Smalltalk Nested Class Modularity in Squeak/Smalltalk Modularität mit geschachtelten Klassen in Squeak/Smalltalk by Matthias Springer A thesis submitted to the Hasso Plattner Institute at the University of Potsdam, Germany in partial fulfillment of the requirements for the degree of Master of Science in ITSystems Engineering Supervisor Prof. Dr. Robert Hirschfeld Software Architecture Group Hasso Plattner Institute University of Potsdam, Germany August 17, 2015 Abstract We present the concept, the implementation, and an evaluation of Matriona, a module system for and written in Squeak/Smalltalk. Matriona is inspired by Newspeak and based on class nesting: classes are members of other classes, similarly to class instance variables. Top-level classes (modules) are globals and nested classes can be accessed using message sends to the corresponding enclosing class. Class nesting effec- tively establishes a global and hierarchical namespace, and allows for modular decomposition, resulting in better understandability, if applied properly. Classes can be parameterized, allowing for external configuration of classes, a form of dependency management. Furthermore, parameterized classes go hand in hand with mixin modularity. Mixins are a form of inter-class code reuse and based on single inheritance. We show how Matriona can be used to solve the problem of duplicate classes in different modules, to provide a versioning and dependency management mech- anism, and to improve understandability through hierarchical decomposition. v Zusammenfassung Diese Arbeit beschreibt das Konzept, die Implementierung und die Evaluierung von Matriona, einem Modulsystem für und entwickelt in Squeak/Smalltalk. Ma- triona ist an Newspeak angelehnt und basiert auf geschachtelten Klassen: Klassen, die, wie zum Beispiel auch klassenseitige Instanzvariablen, zu anderen Klassen gehören.
    [Show full text]
  • Reflection in Smalltalk
    Louvain School of Engineering (EPL) rev. 2012-07-03 Computing Science Engineering Department (INGI) . Reflection and Context-Oriented Programming (R+COP)with 2nd practical session ANSWERS Reflection in Smalltalk .This. session is a hopefully gentle introduction to Smalltalk’s meta-object protocol. You can use the tools of the Smalltalk environment to find answers to all questions. In particular: • Use the System Browser to navigate through classes, their methods and their hierarchies. The class browser also gives you valuable information on the overriding of methods and you can use the right-click menu on any method to explore senders and implementors of any messages used inside the method body. • Use the Finder tool to search for methods implementing a particular message. • Use the Inspector for individual objects, and evaluate expressions in the context of the inspected object. • Select an expression in any browser and use the right-click menu to browse all implementors or senders of the method. This session starts the exploration of reflection in Smalltalk by considering class instantiation, class inheritance, and the interaction between these two concepts. The second part of the session focuses on structural and behavioural reflection. Smalltalk Kernel: Instantiation Relationship 1. What is the class of 1984? Which message can you send to obtain the class of an object? Apply this message to 1984 and inspect the result. Inside the inspector, what do you conclude from evaluating and printing the result of self inside the lower-right text pane? The message that retrieves the class of an instance is class. If you inspect the result of 1984 class, you will obtain an inspector window with a SmallInteger class as window title and self bound to SmallInteger, as you can check by printing self.
    [Show full text]
  • Xcode Chapter.Indd
    Chapter 1 Xcode Many computer books use Chapter 1 to cover introductory material. Xcode Tools Sensei is not one of those books. I want you to start learning immediately. After reading this chapter you’ll know how to create a project, add files to your project, edit source code, model data, read developer documentation, configure the compiler, and build your project into a working Mac OS X program. Creating a Project Every program you write with Xcode requires a project, no matter how small the program is. An Xcode project contains your program’s source code files and other files Xcode needs to build a working program, such as Interface Builder nib files. To create an Xcode project, choose File > New Project, and the Project Assistant window opens. Xcode has the following project categories: n Action n Application n Audio Units n Bundle n Command-Line Utility n Dynamic Library n External Build System n Framework n J2EE n Java n Kernel Extension n Standard Apple Plug-Ins n Static Library I will go into greater detail on the types of projects shortly, but most of you will be making application projects. After choosing the type of project you want to make, click the Next button. Tell Xcode the name of your project and where you want to store it, then click the Finish button. Congratulations! You’ve created an Xcode project. What Xcode includes in a project depends on the type of project you create. Xcode includes the following files for a Cocoa application: n An Objective C source code file, main.m.
    [Show full text]
  • Pharo by Example
    Portland State University PDXScholar Computer Science Faculty Publications and Computer Science Presentations 2009 Pharo by Example Andrew P. Black Portland State University, [email protected] Stéphane Ducasse Oscar Nierstrasz University of Berne Damien Pollet University of Lille Damien Cassou See next page for additional authors Let us know how access to this document benefits ouy . Follow this and additional works at: http://pdxscholar.library.pdx.edu/compsci_fac Citation Details Black, Andrew, et al. Pharo by example. 2009. This Book is brought to you for free and open access. It has been accepted for inclusion in Computer Science Faculty Publications and Presentations by an authorized administrator of PDXScholar. For more information, please contact [email protected]. Authors Andrew P. Black, Stéphane Ducasse, Oscar Nierstrasz, Damien Pollet, Damien Cassou, and Marcus Denker This book is available at PDXScholar: http://pdxscholar.library.pdx.edu/compsci_fac/108 Pharo by Example Andrew P. Black Stéphane Ducasse Oscar Nierstrasz Damien Pollet with Damien Cassou and Marcus Denker Version of 2009-10-28 ii This book is available as a free download from http://PharoByExample.org. Copyright © 2007, 2008, 2009 by Andrew P. Black, Stéphane Ducasse, Oscar Nierstrasz and Damien Pollet. The contents of this book are protected under Creative Commons Attribution-ShareAlike 3.0 Unported license. You are free: to Share — to copy, distribute and transmit the work to Remix — to adapt the work Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
    [Show full text]
  • Comparison of C++ and C
    Comparison of C++ and C# Jim Fawcett CSE681 – Software Modeling and analysis Summer 2005 Table of Contents • Object Models • C# Language • C# Object Model • Common Type System • C# Object Type • Type Class • Class Browser in IDE • Delegates • Events • Threads • Assemblies • C# Libraries Both are Important • C++ has a huge installed base. • Your next employer is very likely to be a C++ house. • C# is gaining popularity very quickly. • But, your next employer may not yet do C#. • CSE681 – Software Modeling and Analysis • Focuses almost exclusively on C# and .Net. • CSE687 – Object Oriented Design: • Focuses almost exclusively on C++ and the Standard Library. Comparison of Object Models Contents • C++ Object Model • .Net Object Model • All objects share a rich memory model: • More Spartan memory model: • Static, stack, and heap • Value types are stack-based only. • Rich object life-time model: • Reference types (all user defined types • Static objects live of the duration of the and library types) live on the heap. program. • Non-deterministic life-time model: • Objects on stack live within a scope defined • All reference types are garbage collected. by { and }. • That’s the good news. • Objects on heap live at the designer’s • That’s the bad news. descretion. • Semantics based on a shallow reference • Semantics based on a deep copy model. model. • That’s the good news. • For compilation, client’s use their • That’s the bad news. server’s meta-data. • For compilation, clients carry their • That is great news. server’s type information. • It is this property that makes .Net • That’s definitely bad news.
    [Show full text]
  • Towards Understanding Programs Through Wear-Based
    Towards Understanding Programs through Wear-based Filtering Robert DeLine1, Amir Khella2, Mary Czerwinski1, George Robertson1 1 2 Microsoft Research Computer Science Department One Microsoft Way Human Computer Interaction Lab Redmond, WA 98052, USA University Of Maryland 1-425-705-4972 College park, MD 20742, USA {rdeline, marycz, ggr} @microsoft.com 1-301-405-2725 [email protected] ABSTRACT formative observation study of professional programmers using a Large software projects often require a programmer to make typical development environment to make changes to unfamiliar changes to unfamiliar source code. This paper presents the results code and the usability problems they experience. of a formative observational study of seven professional To combat the expense of software documentation, we also programmers who use a conventional development environment explore cheap ways to transfer knowledge from programmers to update an unfamiliar implementation of a commonly known familiar with the code to those unfamiliar with it. In previous video game. We describe several usability problems they research, Hill, Holland, Wroblewski and McCandless introduced experience, including keeping oriented in the program’s source the idea of computation wear, namely, capturing a user’s text, maintaining the number and layout of open text documents interaction history with a document and making that history and relying heavily on textual search for navigation. To reduce the available to others interacting with the same document [11]. Other cost of transferring knowledge about the program among researchers have developed the idea of collaborative filtering, developers, we propose the idea of wear-based filtering, a namely, allowing users to rate or annotate portions of a large combination of computational wear and social filtering.
    [Show full text]
  • RAD Studio 2010 Launch DEVELOPERS CONFERENCE
    DEVELOPERS CONFERENCE RAD Studio 2010 Launch Paweł Głowacki EMEA Technical Lead for Delphi, RAD Studio and All-Access Mark Barringer EMEA Partner Manager Agenda • 0900 - 0930 Registracija prisutnih 0930 - 0935 Rije č dobrodošlice (Mladen Kuzminski) 0935 - 0945 Osvrt na kompaniju Embarcadero (Mark Barringer) 0945 - 1000 All-Access (Pawel Glowacki) 1000 - 1045 Delphi 2010 novosti - IDE i jezik (Pawel Glowacki) 1045 - 1100 Kratka pauza 1100 - 1230 Delphi 2010 novosti - VCL i rad s bazama podataka (Pawel Glowacki) 1230 - 1300 Ru čak 1300 - 1400 Pregled alata za rad s bazama podataka (Mark Barringer) 1400 - 1415 Kratka pauza 1415 - 1500 ER/Studio i modeliranje podataka (Mark Barringer) 1500 - 1530 Pitanja i zaklju čak konferencije (Mladen Kuzminski) Embarcadero Technologies Embarcadero Update Who Is Embarcadero? Embarcadero Technologies provides database professionals and application developers with award-winning, multi-platform tools to design, build, and run their software applications and database systems Delphi JBuilder InterBase SMP ER/Studio DB Optimizer C++Builder J Optimizer Blackfish SQL EA/Studio DBArtisan ER Enterprise Performance Delphi Prism 3rdRail Turbo Ruby Portal Center RAD Studio Delphi for PHP Delphi for AS/400 Rapid SQL Schema Examiner Change Manager Our Customers • Embarcadero products serve: • IT development, independent software vendors (ISVs), VARs, database professionals, and large enterprise teams • Most demanding vertical industries including Financial Services and Banking, Manufacturing, Life Sciences, and Telecommunications
    [Show full text]
  • Javachime: Java Class Hierarchy Inspector and Method Executer
    JavaCHIME: Java Class Hierarchy Inspector and Method Executer Pallavi Tadepalli H.Conrad Cunningham Department of Computer and Information Science Department of Computer and Information Science University of Mississippi University of Mississippi 201 Weir Hall 201 Weir Hall University, MS 38677 University, MS 38677 1-662-915-7396 1-662-915-5358 [email protected] [email protected] ABSTRACT 1. INTRODUCTION Java has emerged as one of the most dynamic programming During the past eight years, Java has emerged as a frequent languages today. During the past eight years it has become a choice for the programming language to use in the introductory leading choice as the programming language for an introductory programming course (CS1) in colleges. However some consider course in computer science. Object-oriented programming object-oriented programming (OOP) languages like Java to be (OOP) is often considered to be complex and difficult to grasp too complex for beginners to grasp. by both beginners and experienced procedural language While lectures are useful in specifying concepts, it is “properly programmers. Using Java in an introductory programming designed labs that constitute an integral component of CS1.” [9] language serves a dual purpose; it teaches the syntax and The success of labs lies in the presence of tools that support an constructs of the Java language as well as general object- exploratory approach allowing students to “develop skills and oriented programming concepts. This paper describes an processes for discovering behaviors” [9] of programs. The instructional environment for Java applications called presence of appropriate tools in the lab for teaching CS1 helps JavaCHIME.
    [Show full text]
  • Codewarrior Development Studio IDE 5.5 User's Guide
    CodeWarrior™ Development Studio IDE 5.5 User’s Guide Revised 20030610 Metrowerks, the Metrowerks logo, and CodeWarrior are registered trademarks of Metrowerks Corp. in the US and/or other countries. All other tradenames and trademarks are the property of their respective owners. Copyright © Metrowerks Corporation. 2003. ALL RIGHTS RESERVED. The reproduction and use of this document and related materials are governed by a license agreement media, it may be printed for non-commercial personal use only, in accordance with the license agreement related to the product associated with the documentation. Consult that license agreement before use or reproduction of any portion of this document. If you do not have a copy of the license agreement, contact your Metrowerks repre- sentative or call 800-377-5416 (if outside the US call +1 512-997-4700). Subject to the foregoing non-commercial personal use, no portion of this documentation may be reproduced or transmitted in any form or by any means, electronic or mechanical, without prior written permission from Metrowerks. Metrowerks reserves the right to make changes to any product described or referred to in this document without further notice. Metrowerks makes no warranty, representation or guarantee regarding the merchantability or fitness of its prod- ucts for any particular purpose, nor does Metrowerks assume any liability arising out of the application or use of any product described herein and specifically disclaims any and all liability. Metrowerks software is not authorized for and has not been designed, tested, manufactured, or intended for use in developing applications where the fail- ure, malfunction, or any inaccuracy of the application carries a risk of death, serious bodily injury, or damage to tangible property, including, but not limited to, use in factory control systems, medical devices or facilities, nuclear facilities, aircraft or automobile navigation or communication, emergency systems, or other applica- tions with a similar degree of potential hazard.
    [Show full text]
  • Assuring Software Quality by Code Smell Detection
    Assuring Software Quality by Code Smell Detection (Invited talk, Most Influential Paper Award) Eva van Emden Leon Moonen∗ Vancouver Editor Simula Research Laboratory Vancouver, BC, Canada Lysaker, Norway Email: [email protected] Email: [email protected] Abstract—In this retrospective we will review the paper “Java pointer arithmetic, memory (de)allocation, null references, Quality Assurance by Detecting Code Smells” that was published array bounds errors, etc. Our work took a completely different ten years ago at WCRE. The work presents an approach for the perspective: inspired by the metaphor of “code smells” intro- automatic detection and visualization of code smells and discusses how this approach could be used in the design of a software duced by Beck and Fowler, we reviewed code for problems inspection tool. The feasibility of the proposed approach was that are associated with bad program design and bad pro- illustrated with the development of jCOSMO, a prototype code gramming practices. Code smells were originally introduced smell browser that detects and visualizes code smells in JAVA to describe characteristics of code that indicate that it can be source code. It was the first tool to automatically detect code refactored. “Refactoring is the process of changing a software smells in source code, and we demonstrated the application of this tool in an industrial quality assessment case study. system in such a way that it does not alter the external In addition to reviewing the WCRE 2002 work, we will discuss behavior of the code yet improves its internal structure“. subsequent developments in this area by looking at a selection of Refactoring tidies up source code and reduces its complexity, papers that were published in its wake.
    [Show full text]
  • A Fast Track Guide to ASP.NET
    A Fast Track Guide to ASP.NET Microsoft's .NET technology has attracted a great deal of press since Beta 1 was first released to the world. Since then, mailing lists, newsgroups, and web sites have sprung up containing a mixture of code samples, applications, and articles of various forms. Even if you're not a programmer using existing ASP technology, it's a good bet that you've at least heard of .NET, even if you aren't quite sure what it involves. After all, there's so much information about .NET, that it's sometimes hard to filter out what you need from what's available. With new languages, new designers, and new ways of programming, you might wonder exactly what you need to write ASP.NET applications. That's where this chapter comes in, because we are going to explain exactly what is required, and how we go about using it. The aim is to get you up and running, able to write simple ASP.NET pages as quickly as possible, and give you a solid grounding in the basics of the new framework. This will not only benefit existing ASP programmers, but also people who haven't used ASP, including Visual Basic programmers who need to write web applications. ASP.NET makes the whole job much easier whatever your skill set. So, in particular we are going to be looking at: ❑ Installing and testing ASP.NET ❑ The benefits of the new technology ❑ The basic differences between ASP and ASP.NET ❑ The new programming model ❑ The rich hierarchy of server controls We start with the simple discussion of why ASP.NET has come about.
    [Show full text]