On Wednesday, 1 July 2020 at 18:30:15 UTC, Dennis wrote:

I have a function that checks a global error constant of a C library (OpenGL) like this:
```
void assertNoOpenGLErrors() {
    if (glGetError() != GL_NO_ERROR) {
assert(0); // stack trace points to here instead of caller
    }
}
```

And I would like to rewrite it to this:
```
void assertNoOpenGLErrors() {
    if (glGetError() != GL_NO_ERROR) {
        print(getStackTrace().filterTrace());
        exit();
    }
}
```

void assertNoOpenGLErrors(string file = __FILE__, int line = __LINE__, string func = __PRETTY_FUNCTION__)
{
    if (glGetError() != GL_NO_ERROR) {
        print(file, ":", line, ":", func, ": blah");
        exit();
    }
}

:)

Reply via email to