The C++ Concept Deck

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/4

flashcard set

Earn XP

Description and Tags

A curated flashcard deck covering the most important C++ concepts, language mechanics, and interview-relevant theory.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

5 Terms

1
New cards

What is C++?

  • general purpose programming language that is biased towards system programming.

  • supports object oriented programming (abstraction, encapsulation, inheritance, polymorphism)

  • supports generic programming (reusable containers/algorithms)

  • supports functional programming (programming paradigm based on the idea of building software by composing pure functions)

2
New cards

Why does C++ allow unsafe code?

  • to access hardware directly (e.g. to treat an integer as a pointer to (address of) a device register)

  • to achieve optimal run-time and space performance (e.g. unchecked access to elements of an array and unchecked access to an object through a pointer)

  • to be compatible with C

3
New cards

What unsafe C++ code practices should be avoided unless absolutely necessary?

  • don’t use casts

  • keep C-style [] arrays out of interfaces

    • hide them in the innards of high-performance functions and classes where they are needed and write the rest of the program using proper strings, vectors, etc.

  • avoid void*

    • keep them inside low-level functions and data structures if you really need them and present type safe interfaces, usually templates, to your users

  • avoid unions

  • if you have any doubts about the validity of a pointer, use a smart pointer instead

  • don’t use “naked” new and delete

    • use containers, resource handles, etc., instead

  • don’t use ...-style variadic functions (“printf style”)

  • avoid macros except for #include guards

4
New cards

Why are some things left undefined in C++?

C++ is meant to exploit hardware directly and efficiently. C++ is meant deal with hardware entities (bytes, bits, words, addresses) they way they are provided on the machine.

5
New cards