1. Comparison to C¶
What differentiates Crowbar from C?
Some of the footguns and complexity in C come from misfeatures that can simply not be used.
Some constructs in C are almost always the wrong thing.
Chaining mixed left and right shifts (e.g.
x << 3 >> 2)
Chaining relational/equality operators (e.g.
3 < x == 2)
Mixed chains of bitwise or logical operators (e.g.
2 & x && 4 ^ y)
Subtly variable-size integer types (
The comma operator
Some constructs in C exhibit implicit behavior that should instead be made explicit.
Octal escape sequences
Using an assignment operator (
+=, etc) or (postfix)
--as components in a larger expression
The conditional operator
Preprocessor macros (but constants are fine)
1.1.2. Needless Complexity¶
Some type modifiers in C exist solely for the purpose of enabling optimizations which most compilers can do already.
Some type modifiers in C only apply in very specific circumstances and so aren’t important.
Some C features are footguns by default, so Crowbar ensures that they are only used correctly.
C’s syntax isn’t perfect, but it’s usually pretty good. However, sometimes it just sucks, and in those cases Crowbar makes changes.
C’s variable declaration syntax is far from intuitive in nontrivial cases (function pointers, pointer-to-
const-pointer, etc). Crowbar uses
simplified type syntaxto keep types and variable names distinct.
complex(why drag the preprocessor into it?)
_to numeric literals as a separator
All string literals, char literals, etc are UTF-8
Octal literals have a
0Obecause that looks nasty)
1.3.2. Trivial Room For Improvement¶
Binary literals, prefixed with