isocpp / isocpp/CppCoreGuidelines

Error Handling with Core Guidelines GSL Expects, Ensures, and narrow_cast

Offen
#1,663 11 Kommentare 2 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@hsutter arbeitet bereits daran.

Seit 01.10.2020.

Vorherrschende Sprache
CSS
Sterne
45.3k
Forks
5.6k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I am trying to follow the Cpp Core Guidelines and use GSL where appropriate. In particular, I would like to use Expects and Ensures for pre and post-conditions, as well as span, and narrow_cast, but the error handling is not robust and does not provide any diagnostics. When encountering errors GSL simply calls terminate leaving the tester with no clues as to what caused the termination.

So my question is: How does one use GSL and keep code robust in the presence of errors? Or more simply, how to use GSL and get error diagnostics prior to termination?

(I posted this same question on StackOverflow, https://stackoverflow.com/questions/63350483/error-handling-with-core-guidelines-gsl-expects-ensures-and-narrow-cast, but it has not received any feedback.)

I appreciate any help.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.