aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2020-10-25 11:32:02 -0600
committerMelody Horn <melody@boringcactus.com>2020-10-25 11:32:02 -0600
commite434036cffd2a5fa1d7ca9195b45cf1c61a71537 (patch)
tree86153d686d5b90a898b8303c80119d0f2268b9e1
parentd9fcad8cd6ec6f0469d25a1c6ad640d60a485d1c (diff)
downloadspec-e434036cffd2a5fa1d7ca9195b45cf1c61a71537.tar.gz
spec-e434036cffd2a5fa1d7ca9195b45cf1c61a71537.zip
add octal literals
-rw-r--r--syntax.md3
-rw-r--r--vs-c.md2
2 files changed, 3 insertions, 2 deletions
diff --git a/syntax.md b/syntax.md
index 6413f8a..c195811 100644
--- a/syntax.md
+++ b/syntax.md
@@ -74,9 +74,10 @@ Subsequent characters may have any of the above-listed Unicode categories, or on
## Constants
-A *constant* can have one of five types:
+A *constant* can have one of six types:
- a *decimal constant*, a sequence of characters drawn from the set {`0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `_`};
- a *binary constant*, a prefix (either `0b` or `0B`) followed by a sequence of characters drawn from the set {`0`, `1`, `_`};
+- an *octal constant*, the prefix `0o` followed by a sequence of characters drawn from the set {`0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `_`};
- a *hexadecimal constant*, a prefix (either `0x` or `0X`) followed by a sequence of characters drawn from the set {`0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `A`, `a`, `B`, `b`, `C`, `c`, `D`, `d`, `E`, `e`, `F`, `f`, `_`};
- a *floating-point constant*, a decimal constant followed by one of
- `.` followed by a decimal constant,
diff --git a/vs-c.md b/vs-c.md
index b6cbcd5..fe4ed3e 100644
--- a/vs-c.md
+++ b/vs-c.md
@@ -9,7 +9,6 @@ Some of the footguns and complexity in C come from misfeatures that can simply n
Some constructs in C are almost always the wrong thing.
- `goto`
-- Octal literals
- Hexadecimal float literals
- Wide characters
- Digraphs
@@ -55,6 +54,7 @@ However, sometimes it just sucks, and in those cases Crowbar makes changes.
- `_Bool` is just `bool`, `_Complex` is just `complex` (why drag the preprocessor into it?)
- Adding a `_` to numeric literals as a separator
- All string literals, char literals, etc are UTF-8
+- Octal literals have a `0o` prefix (never `0O` because that looks nasty)
# Additions