Skip to content
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

Strange formatting in question 323 #343

Closed
tocic opened this issue Jul 28, 2024 · 2 comments · Fixed by #346
Closed

Strange formatting in question 323 #343

tocic opened this issue Jul 28, 2024 · 2 comments · Fixed by #346

Comments

@tocic
Copy link
Contributor

tocic commented Jul 28, 2024

image

The example is rendered as if the catch and return keywords were comments. Is it possible to fix this somehow?

@knatten
Copy link
Owner

knatten commented Jul 28, 2024

I'm not able to, at least. I even tried pulling the code out of the quote, like this, and it sill renders the same way:

This is taken from an example in §[except.ctor]¶2 in the standard about stack unwinding:

> Each object with automatic storage duration is destroyed if it has been constructed, but not yet destroyed, since the try block was entered. If an exception is thrown during the destruction of temporaries or local variables for a return statement, the destructor for the returned object (if any) is also invoked. The objects are destroyed in the reverse order of the completion of their construction. [ Example:
 
    struct A { };

    struct Y { ~Y() noexcept(false) { throw 0; } };

    A f() {
      try {
        A a;
        Y y;
        A b;
        return {};      // #1
      } catch (...) {
      }
      return {};        // #2
    }
 
> 
> At #1, the returned object of type A is constructed. Then, the local variable b is destroyed ([stmt.jump]). Next, the local variable y is destroyed, causing stack unwinding, resulting in the destruction of the returned object, followed by the destruction of the local variable a. Finally, the returned object is constructed again at #2. — end example ]

It is worth noting that at the time of writing, neither GCC, Clang nor MSVC conform to the behaviour described in the standard, and instead print `bacd`, `bad` and `bad`, respectively.
Screenshot 2024-07-28 at 10 38 26

@knatten
Copy link
Owner

knatten commented Jul 29, 2024

Let's investigate this together with #345.

knatten added a commit that referenced this issue Jul 30, 2024
We want newlines to be treated as hard breaks; like StackOverflow and
GitHub flavored Markdown do. Previously this was done with a custom
hack, let's use an officially supported extension to our markdown
renderer instead.

Fixes knatten/cppquiz23#257
Fixes #343
Helps with #345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants