From 9e0e00a9501d2b1e93a4237f313e3a955ccc2152 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Tue, 5 Apr 2022 17:22:17 +0200 Subject: Delete docs directory --- docs/cpp-coding/09-Considering_Correctness.md | 30 --------------------------- 1 file changed, 30 deletions(-) delete mode 100644 docs/cpp-coding/09-Considering_Correctness.md (limited to 'docs/cpp-coding/09-Considering_Correctness.md') diff --git a/docs/cpp-coding/09-Considering_Correctness.md b/docs/cpp-coding/09-Considering_Correctness.md deleted file mode 100644 index 5bc8b61ec..000000000 --- a/docs/cpp-coding/09-Considering_Correctness.md +++ /dev/null @@ -1,30 +0,0 @@ -# Considering Correctness - -## Avoid Typeless Interfaces - - -Bad Idea: - -```cpp -std::string find_file(const std::string &base, const std::string &pattern); -``` - -Better Idea: - -```cpp -std::filesystem::path find_file(const std::filesystem::path &base, const std::regex &pattern); -``` - -The above is better but still suffers from having implicit conversions from `std::string` to `std::filesystem::path` and back. - -Consider using a typesafe library like - - * https://foonathan.net/type_safe/ - * https://github.com/rollbear/strong_type - * https://github.com/joboccara/NamedType - -Note that stronger typing can also allow for more compiler optimizations. - -* [Sorting in C vs C++](Sorting in C vs C++.pdf) - - -- cgit v1.2.3