Commit f9a76c94 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

Reformulate the paragraph about ; at end of struct.

parent 61d261c1
......@@ -125,17 +125,17 @@
%% Cell type:markdown id: tags:
### The semicolon at the end of a `struct`
This comes historically from the C, where a `struct` is considered as a type declaration and it allows to do:
**Xeus-cling issue:** Here cling doesn't manage to compile it but it is accepted rightfully by a full-fledged compiler (see for instance [@Coliru](http://coliru.stacked-crooked.com/a/3b77606ea8082485)):
This comes historically from the C, where a `struct` could be defined and initialized at the same time (or should - Xeus-cling doesn't manage it... As usual you may check a full-fledged compiler accepts it [@Coliru](http://coliru.stacked-crooked.com/a/3b77606ea8082485)):
%% Cell type:code id: tags:
``` C++17
// Xeus-cling issue (at least circa May 2021)
struct Vector
{
double x;
double y;
double z;
......@@ -146,11 +146,11 @@
v1.z = -2.;
```
%% Cell type:markdown id: tags:
This is the reason why a semicolon is always required at the end of a `struct` or a `class` declaration.
This is absolutely **not** encouraged in C++, but it may help you to remember always closing a `struct` (or later a `class`) with a semicolon.
%% Cell type:markdown id: tags:
## Passing a struct to a function
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment