Skip to content

Commit 91f193e

Browse files
authored
docs: fix some typos and confusing wording (#976)
* docs: fix some typos and confusing wording * restore std::ssize
1 parent 335d3a7 commit 91f193e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

docs/reference-cpp2.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
### Comments
1010

11-
The usual `// line comments` and `/* stream comments */` are supported. For exmaple:
11+
The usual `// line comments` and `/* stream comments */` are supported. For example:
1212

1313
``` cpp title="Example: Comments"
1414
// A line comment: After //, the entire rest of the line is part of the comment
@@ -142,7 +142,7 @@ Types can be qualified with `const` and `*`. Types are written left-to-right, so
142142

143143
``` cpp title="Example: Type qualifiers"
144144
// A const pointer to a non-const pointer to a const i32 object
145-
p: const * * const i32; //
145+
p: const * * const i32;
146146
```
147147

148148
### Literals
@@ -272,7 +272,7 @@ There are two kinds of `is`:
272272

273273
### `as` — safe casts and conversions
274274

275-
An `x as T` expression allows safe type casts. `x` must be an object or expression, and `T` must be a type. It supports both static and dynamic typing, including customization with support for the standard dynamically tyuped libraries `std::variant`, `std::optional`, and `std::any` provided in the box. For example:
275+
An `x as T` expression allows safe type casts. `x` must be an object or expression, and `T` must be a type. It supports both static and dynamic typing, including customization with support for the standard dynamically typed libraries `std::variant`, `std::optional`, and `std::any` provided in the box. For example:
276276

277277
``` cpp title="Example: Using as"
278278
main: () = {
@@ -323,7 +323,7 @@ test: (x) = {
323323
// Sample call site
324324
test(42);
325325
// Behaves as if the following function were called:
326-
// test: (x) = { std::cout << (:std::string = "the answer") << "\n";; }
326+
// test: (x) = { std::cout << (:std::string = "the answer") << "\n"; }
327327
// (and that's why inspect alternatives are introduced with '=')
328328
```
329329
@@ -542,7 +542,7 @@ skat_game: @enum<i16> type = {
542542

543543
Consider `hearts`: It's a member object declaration, but it doesn't have a type (or a default value) which is normally illegal, but here it's okay because the `@enum<i16>` metafunction fills them in: It iterates over all the data members and gives each one the underlying type (here explicitly specified as `i16`, otherwise it would be computed as the smallest signed type that's big enough), and an initializer (by default one higher than the previous enumerator).
544544

545-
Unlike C `enum`, this `@union` is scoped and strongly type (does not implicitly convert to the underlying type.
545+
Unlike C `enum`, this `@enum` is scoped and strongly typed (does not implicitly convert to the underlying type.
546546

547547
Unlike C++11 `enum class`, it's "just a `type`" which means it can naturally also have member functions and other things that a type can have:
548548

@@ -616,7 +616,7 @@ Unlike C `union`, this `@union` is safe to use because it always ensures only th
616616

617617
Unlike C++11 `std::variant`, this `@union` is easier to use because its alternatives are anonymous, and safer to use because each union type is a distinct type. [^variant]
618618

619-
Each `@union` type has its own type-safe name, has clear and unambiguous named members, and safely encapsulates a discriminator to rule them all. Sure, it uses unsafe casts in the implementation, but they are fully encapsulated, where they can be tested once and be safe in all uses. That makes @union:
619+
Each `@union` type has its own type-safe name, has clear and unambiguous named members, and safely encapsulates a discriminator to rule them all. Sure, it uses unsafe casts in the implementation, but they are fully encapsulated, where they can be tested once and be safe in all uses.
620620

621621
Because a `@union type` is still a `type`, it can naturally have other things normal types can have, such as template parameter lists and member functions:
622622

docs/reference-cppfront.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ When cppfront compiles such a mixed file, it just passes through the Cpp1 code a
3232

3333
- **Code written in Cpp1 is order-dependent as usual.** When either the caller or the callee (or both) are written in Cpp1 syntax, the callee must be declared before the caller.
3434

35-
However, this source file is not valid, because it tries to nest Cpp2 code inside Cpp1 code, and vice versa:
35+
However, the following source file is not valid, because it tries to nest Cpp2 code inside Cpp1 code, and vice versa:
3636

3737
``` cpp title="ERROR.cpp2 — this is NOT allowed" linenums="1" hl_lines="5 6 9 14"
3838
#include <iostream> // Cpp1 syntax

0 commit comments

Comments
 (0)