{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

C++-overview4

C++-overview4 - An Overview of C Douglas C Schmidt C...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
An Overview of C++ Douglas C. Schmidt Professor Department of EECS [email protected] Vanderbilt University www.dre.vanderbilt.edu/ schmidt/ (615) 343-8197 www.dre.vanderbilt.edu/ schmidt/PDF/C++-overview.pdf January 18, 2012 An Overview of C++ Douglas C. Schmidt C++ Overview C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80’s – nearly 30 years ago! The original cfront translated C++ into C for portability * However, this was difficult to debug and potentially inefficient Many native host machine compilers now exist * e.g., C++ Builder, clang, Comeau C/C++, GCC, Intel C++ Compiler, Microsoft Visual C++, Sun Studio, etc. C++ is a mostly upwardly compatible extension of C that provides: 1. Stronger typechecking 2. Support for data abstraction 3. Support for object-oriented programming 4. Support for generic programming Vanderbilt University 1 An Overview of C++ Douglas C. Schmidt C++ Design Goals As with C, run-time efficiency is important Unlike other languages ( e.g., Ada, Java, C#, etc.) complicated run-time libraries and virtual machines have not traditionally been required for C++ * Note, that there is no language-specific support for concurrency, persistence, or distribution in C++ Compatibility with C libraries & traditional development tools is emphasized, e.g., Object code reuse * The storage layout of structures is compatible with C * e.g., support for X-windows, standard ANSI C library, & UNIX/WIN32 system calls via extern block C++ works with the make recompilation utility Vanderbilt University 2 An Overview of C++ Douglas C. Schmidt C++ Design Goals (cont’d) “As close to C as possible, but no closer” i.e., C++ is not a proper superset of C backwards compatibility is not entirely maintained * Typically not a problem in practice... Note, certain C++ design goals conflict with modern techniques for: 1. Compiler optimization e.g., pointers to arbitrary memory locations complicate register allocation & garbage collection 2. Software engineering e.g., separate compilation complicates inlining due to difficulty of interprocedural analysis Dynamic memory management is error-prone Vanderbilt University 3
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
An Overview of C++ Douglas C. Schmidt Major C++ Enhancements 1. C++ supports data abstraction & encapsulation e.g., the class mechanism & name spaces 2. C++ supports object-oriented programming features e.g., abstract classes, inheritance, & virtual methods 3. C++ supports generic programming e.g., parameterized types 4. C++ supports sophisticated error handling e.g., exception handling 5. C++ supports identifying an object’s type at runtime e.g., Run-Time Type Identification (RTTI) Vanderbilt University 4 An Overview of C++ Douglas C. Schmidt Important Minor C++ Enhancements C++ enforces type checking via function prototypes Provides type-safe linkage Provides inline function expansion Declare constants that can be used to define static array bounds with the const type qualifier Built-in dynamic memory management via new & delete operators Namespace control
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern