Skip to content

Commit

Permalink
Added note about template main and corrected typo
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-rifkin committed May 17, 2022
1 parent 5c32d13 commit 8fad07d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ T foo((T()));
```cpp
struct S { ;;;;; };
```
- The following is The following code is probably, technically, well-formed in the current working draft of the
standard (and may have been before too):
```cpp
template<typename T> void main(T) {}
int main() {}
```
This is related to changes in P1787. Sadly, no compiler supports this.
- [Function try-blocks](https://en.cppreference.com/w/cpp/language/function-try-block) are a
convenient way to wrap an entire function body with exception handlers and the only way to catch
exceptions in member initializer lists:
Expand Down Expand Up @@ -390,7 +397,7 @@ int main(int a, char *b[(first++ > 8) ? 1 : main()]) {
int main(int, char*[puts("Hello World")]) {}
```
- `auto` is a keyword in C. Not to be confused with C++ `auto`, C `auto` does absolutely nothing.
- `extern cosnt void x;` is valid a valid declaration in C for the same reason `extern struct S s;` is valid - `void` is
- `extern const void x;` is valid a valid declaration in C for the same reason `extern struct S s;` is valid - `void` is
an incomplete type
- This is not valid in C++ because incomplete types in general are not allowed in extern declarations, incomplete
class types are specifically explicitly permitted in [[dcl.stc]/7](https://eel.is/c++draft/dcl.stc#7)
Expand Down

0 comments on commit 8fad07d

Please sign in to comment.