Skip to content

Commit

Permalink
We can use = {} for default arg values in function declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
dacap committed Jul 19, 2024
1 parent 9da1060 commit 3c44831
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/CODING_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,11 @@ targetting macOS 10.9, some notes are added about this:
* You can use `<atomic>`, `<thread>`, `<mutex>`, and `<condition_variable>`
* Prefer `using T = ...;` instead of `typedef ... T`
* Use `[[fallthrough]]` if needed
* Use `= {}` only to specify a default argument value of an
user-defined type in a function declaration, e.g.
`void func(const std::string& s = {}) { ... }`.
In other cases (e.g. a member variable of an user-defined type)
it's not required or we prefer to use the explicit value
for built-in types (`int m_var = 0;`).
* We use gcc 9.2 or clang 9.0 on Linux, so check the features available in
https://en.cppreference.com/w/cpp/compiler_support

0 comments on commit 3c44831

Please sign in to comment.