Let's walk through quick-lint-js, a 100k-line C++ project, and talk about the code style and design decisions. Links: Stewart Lynch's Sane C++ series: https://www.youtube.com/watch?v=noA4moTihU4&list=PLCE2sZmRNLTM3PRM2UCebzODSVHtkV5sC C++ Core Guidelines: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines decode_utf_8_result design help from u/LegionMammal978: https://old.reddit.com/r/rust/comments/104md0s/is_coding_in_rust_as_bad_as_in_c_a_practical/j3b6afz/ 00:00:00 dev environment 00:00:36 font 00:00:55 editor 00:01:24 terminal 00:01:48 copyright comments 00:03:39 reduce clutter 00:05:05 copyright year 00:05:57 copyright checker 00:06:19 source file generator 00:06:37 how I write new code 00:07:09 includes 00:07:38 .h next to .cpp 00:08:40 namespace 00:10:19 citation comment 00:10:57 naming style 00:11:36 preferred style 00:13:09 custom syntax highlighting 00:15:06 char8_t 00:16:25 char8_t vs char 00:17:55 nested functions 00:19:08 number literals 00:19:38 raw pointers 00:20:35 smart pointers 00:22:04 anonymous namespace 00:22:55 which compiler? 00:23:37 compiler warnings 00:25:02 returning classes 00:25:35 struct vs class 00:26:02 better design 00:27:23 char8_t confusion 00:28:34 designated initializers 00:29:22 zero initialization 00:30:01 assert 00:30:18 QLJS_ASSERT 00:30:51 custom assert message 00:31:46 better assert debugging 00:32:16 cassert sucks to debug 00:34:40 if variables 00:37:25 casting 00:39:22 in_range 00:40:53 narrow_cast debugging 00:42:05 source_location 00:42:36 __builtin_LINE 00:43:33 narrow_cast performance 00:44:25 todo comments 00:45:16 issue tracking 00:46:49 performance notes 00:47:23 column limit 00:48:24 screen size 00:49:02 monitor aspect ratio 00:49:43 hard column limits 00:52:06 type inference 00:53:46 object initialization 00:54:30 explicit 00:55:01 implicit 00:57:06 no implicit in Rust 00:58:21 Rust .. 00:58:40 most vexing parse 01:00:13 header file 01:00:29 include guards 01:01:45 include guard fixer 01:02:40 messy #include guards 01:03:18 file organization 01:04:52 #include 01:05:17 namespace references 01:06:46 code formatting 01:07:28 legacy headers 01:08:37 #include order 01:11:00 #include style 01:12:15 header organization 01:12:29 macros in headers 01:13:19 header example 01:14:02 blank lines 01:15:03 forward declarations 01:15:52 simdjson-fwd 01:18:04 portability and the standard library 01:19:06 working around compiler bugs 01:20:07 port folder 01:21:18 binary bloat 01:22:45 binary size data 01:24:07 std::filesystem::path bloat 01:25:12 #if defined 01:26:41 platform-specific files 01:27:31 everything is compilable 01:28:28 std::filesystem::path 01:30:08 why not std::filesystem 01:32:40 exceptions & error handling 01:33:45 why use C++ exceptions? 01:34:37 try_catch_stack destructors 01:35:34 result 01:36:57 static and dynamic analysis 01:37:45 clang-tidy 01:38:47 warnings in CI 01:40:04 what's next