Skip to content

Instantly share code, notes, and snippets.

@jacking75
Forked from VeganPower/c++Course.md
Created August 31, 2020 04:01
Show Gist options
  • Save jacking75/31c31ac2bef99a19f2de487f71a17b40 to your computer and use it in GitHub Desktop.
Save jacking75/31c31ac2bef99a19f2de487f71a17b40 to your computer and use it in GitHub Desktop.
Low level programming in C++

Reference CPU: Multicore AVX 2 capable

Lets' start:

  • Compiler / compile units / linker.
    • Setup makefile
  • Imperative algorithm
  • Understand our processor
    • bit/byte/word/dword/qword
    • registry
    • ISA

Basic operation:

Project: Console output - Hello, World.

  • Types
    • complement 2
  • Variables / Constant
  • Comments
    • Good comments, bad comments
    • Naming variables
  • Arithmetic operation
  • Bitwise operation
  • Boolean operation
  • Variable scope

Project: Flow Guess the number.

  • Flow control
    • if else
    • conditional operator
    • switch
    • loop
      • for
      • do while
      • while
      • c++11 for

Project: Tic tac toe

  • type promotion / downgrade

  • structs, class

  • array

  • Basic SFML

  • Include header

  • libraries

Project: Pong

  • Floating point
    • float / double
  • Functions
    • Declaration definition
    • Function overloading
    • Recursive functions
    • Operator function
  • Compiling time
  • inline function
  • constexpr
  • enum
  • MACROS / DEFINE
  • namespace
  • typedef / using
  • auto

Project: Mandelbrot

Memory:

  • Memory type, heap, stack
  • Pointers / reference
  • * & -> operator
  • nullptr
  • Page fault / pagination and virtual memory
  • malloc / free
  • new / delete / new[] / delete[]
  • Memory leaks
  • Ownership / Smart pointer
  • Raw pointer usage
  • Pointer aliasing

Project: Simple 2d game

Objects

  • constructor, destructor
  • copy operator, move operator
  • Rule of 3, 5, 0
  • operator overloading
  • inheritance
  • Operator overload
    • member function
    • virtual function
    • vtable

Structures and Algorithm:

  • Sorting
    • Insertion
    • Bubble
    • Shell
    • Merge
    • Quick
    • std::sort
    • Radix
  • List / Heap / hashmap / tree / red black tree

std... stuff

  • vector, string, string_view
  • iterators
  • views

Project Array class

Generic programming:

  • Debug performance, sad stl libraries
  • Memory buffer
  • Scratch array
  • Metaprogramming templates
    • type traits
  • Concepts

Error handling:

  • Exceptions
  • Error code
  • std::optional
  • asserts
  • log

Design pattern

  • Behaviour
  • Observer
  • Singleton

Let's go faster:

  • Let's see our processor more deeply
  • Benchmark
  • Find bottleneck
  • Instruction dependency
  • Alignment / Struct Packing
  • Review if
    • Branch prediction
    • conditional operator
  • SIMD / AVX
  • Cache
    • Prefetch
    • Memory access pattern
  • Data oriented programming

Let's go wider / Multithreading

  • Threads
  • Mutex
  • Semaphore
  • Conditional variables
  • System call
  • Atomics
  • Spin lock
  • Pre-emption
  • Thread-local storage
  • Light weight threads
    • Job scheduler
  • Lock free structures
    • ring buffer
    • message queue

Let's go safe:

  • OOP
    • Encapsulation
    • Internal consistency
    • Inheritance
    • Composition
  • RAII
  • Single responsibility principle

Design a more balanced program:

  • Safe, fast? Why not both?
    • Divide et impera
  • Design an ECS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment