Skip to content

More docs reviews #990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/cpp2/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Cpp2 supports the same fundamental types as today's Cpp1, but additionally provi
| `ulonglong` | `#!cpp unsigned long long` |
| `longdouble` | `#!cpp long double` |

| For compatibility/interop only,<br> so deliberately ugly names | Synonym for | Notes |
| For compatibility/interop only,<br> so deliberately ugly names | Synonym for (these multi-word<br> names are not allowed in Cpp2) | Notes |
|---|---|---|
| `_schar` | `#!cpp signed char` | Normally, prefer `i8` instead |
| `_uchar` | `#!cpp unsigned char` | Normally, prefer `u8` instead |
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ main: () = {

## What is Cpp2?

"Cpp2," short for "C++ syntax 2," is my ([Herb Sutter's](https://github.com/hsutter)) personal project to try to make writing ordinary C++ types/functions/objects be much **simpler and safer**, without breaking backward compatibility. Bjarne Stroustrup said it best:
"Cpp2", short for "C++ syntax 2", is my ([Herb Sutter's](https://github.com/hsutter)) personal project to try to make writing ordinary C++ types/functions/objects be much **simpler and safer**, without breaking backward compatibility. Bjarne Stroustrup said it best:

> "Inside C++, there is a much smaller and cleaner language struggling to get out." <br>&emsp;&emsp;— Bjarne Stroustrup, _The Design and Evolution of C++_ (D&E), 1994
>
Expand Down
8 changes: 4 additions & 4 deletions docs/welcome/hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ auto hello(cpp2::in<std::string_view> msg) -> void {
std::cout << ("Hello, " + cpp2::to_string(msg) + "!\n"); }
```

Here we can see more of how Cpp2 makes it features work.
Here we can see more of how Cpp2 makes its features work.

**How: Consistent context-free syntax.**

Expand All @@ -110,15 +110,15 @@ Here we can see more of how Cpp2 makes it features work.

**How: Simplicity through generality + defaults.**

- **Line 7: `in` parameters** are implemented using `#cpp2::in<>`, which is smart enough to pass by `#!cpp const` value when that's safe and appropriate, otherwise by `#!cpp const&`, so you don't have to choose the right one by hand.
- **Line 7: `in` parameters** are implemented using `#!cpp cpp2::in<>`, which is smart enough to pass by `#!cpp const` value when that's safe and appropriate, otherwise by `#!cpp const&`, so you don't have to choose the right one by hand.

**How: Order-independent by default.**

- **Lines 5 and 7: Order independence** happens because cppfront generates all the type and function forward declarations for you, so you don't have to. That's why `main` can just call `hello`: Both are forward-declared, so they can both see each other.
- **Lines 5 and 7: Order independence** happens because cppfront generates all the type and function forward declarations for you, so you don't have to. That's why `main` can just call `hello`: both are forward-declared, so they can both see each other.

**How: Seamless compatibility and interop.**

- **Lines 9-11 and 16: Ordinary direct calls** to existing C++ code, so there's never a need for wrapping/marshaling/thunking.
- **Lines 9-11 and 15: Ordinary direct calls** to existing C++ code, so there's never a need for wrapping/marshaling/thunking.

**How: C++ standard library always available.**

Expand Down
1 change: 1 addition & 0 deletions docs/welcome/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

To start trying out Cpp2 syntax in any existing C++ project, just add a build step to translate the Cpp2 to Cpp1 syntax:

- Copy the `.cpp` file to the same name with a `.cpp2` extension.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes you're converting an existing file. If it's a new file, you'd need to add both to the project.

- Add the `.cpp2` file to the project, and ensure the `.cpp` is in C++20 mode.
- Tell the IDE to build that file using a custom build tool to invoke cppfront.

Expand Down