From 422505a061f8ec09bf041073c34efe37ba7fe4bb Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Sat, 24 Oct 2020 22:28:29 -0600 Subject: simplify C comparison structure --- errors.md | 1 + vs-c.md | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 errors.md diff --git a/errors.md b/errors.md new file mode 100644 index 0000000..1ea1912 --- /dev/null +++ b/errors.md @@ -0,0 +1 @@ +TODO diff --git a/vs-c.md b/vs-c.md index 60d7905..bceaab1 100644 --- a/vs-c.md +++ b/vs-c.md @@ -6,7 +6,7 @@ Some of the footguns and complexity in C come from misfeatures that can simply n ## Footguns -### Almost Always The Wrong Thing +Some constructs in C are almost always the wrong thing. - `goto` - Octal literals @@ -19,7 +19,7 @@ Some of the footguns and complexity in C come from misfeatures that can simply n - Mixed chains of bitwise or logical operators (e.g. `2 & x && 4 ^ y`) - The comma operator `,` -### Explicit Beats Implicit +Some constructs in C exhibit implicit behavior that should instead be made explicit. - `typedef` - Octal escape sequences @@ -29,12 +29,12 @@ Some of the footguns and complexity in C come from misfeatures that can simply n ## Needless Complexity -### Let The Compiler Decide +Some type modifiers in C exist solely for the purpose of enabling optimizations which most compilers can do already. - `inline` - `register` -### Who Even Cares +Some type modifiers in C only apply in very specific circumstances and so aren't important. - `restrict` - `volatile` @@ -61,7 +61,9 @@ However, sometimes it just sucks, and in those cases Crowbar makes changes. ## Anti-Footguns - C is generous with memory in ways that are unreliable by default. - Crowbar adds [memory safety guarantees](safety.md) to make correctness the default behavior. + Crowbar adds [memory safety conventions](safety.md) to make correctness the default behavior. +- C's conventions for error handling are unreliable by default. + Crowbar adds [error propagation](errors.md) to make correctness the default behavior. ## Trivial Room For Improvement -- cgit v1.2.3