From f9a76c94b1a57513af1abfd373460101642f1082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gilles?= <sebastien.gilles@inria.fr> Date: Fri, 7 May 2021 17:24:04 +0200 Subject: [PATCH] Reformulate the paragraph about ; at end of struct. --- 2-ObjectProgramming/1-Introduction.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/2-ObjectProgramming/1-Introduction.ipynb b/2-ObjectProgramming/1-Introduction.ipynb index 23da4eb..0a972ce 100644 --- a/2-ObjectProgramming/1-Introduction.ipynb +++ b/2-ObjectProgramming/1-Introduction.ipynb @@ -163,9 +163,7 @@ "metadata": {}, "source": [ "### The semicolon at the end of a `struct`\n", - "This comes historically from the C, where a `struct` is considered as a type declaration and it allows to do:\n", - "\n", - "**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)):" ] }, { @@ -174,6 +172,8 @@ "metadata": {}, "outputs": [], "source": [ + "// Xeus-cling issue (at least circa May 2021)\n", + "\n", "struct Vector\n", "{\n", " double x;\n", @@ -190,7 +190,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "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." ] }, { -- GitLab