Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Ptr vs Ref for Output Params

TL;DR

  • Why pass-by-ptr is better than pass-by-ref for output params in C++
  • This is recommended by Google C++ style guide (used in industry)

Video Overview

  • C++ double variables and add function example
  • Output params - pass variable by reference
  • Output params - pass variable as a pointer
  • Which approach is better (simpler, readable, maintainable, code story)
    • Prefer using return values over output params (if possible)
    • Google C++ style guide recommends the pointer approach
  • AI vibe coding, code reviewing rant

Titles

  • Google C++ Style Guide: Pointers vs References for Output
  • C++ Pointers vs References: Which is Better for Outputs?
  • Google C++ Coding Standards: Why use Pointers for Out Parameters?
  • How to Guide AI to Write Clean C++ (Google Style Edition)
  • Vibe Coding C++: Why You Need the Google Style Guide
  • Prompting for Performance: Using Google C++ Rules in Cursor AI
int sum(int& a, int* b);

Timestamps

  • 00:00 Intro

References