From 9f6948d9e04d733a45c872c78e8c51dc23576f2b Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Mon, 2 Dec 2024 09:16:12 -0800 Subject: [PATCH] rfc7: no side effects on error Problem: we have internalized an expectation that functions do not have side effects on error, but this is undocumented. Add this to RFC 7. --- spec_7.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec_7.rst b/spec_7.rst index 44a6f85..0d73c10 100644 --- a/spec_7.rst +++ b/spec_7.rst @@ -192,6 +192,13 @@ Examples: In order to represent the full range of values, enums that use a zero for none or similar SHOULD include an item with the value zero to represent that state. +Error Handling +============== + +A function SHOULD NOT have side effects on failure. For example, a function +that takes a reference on an object parameter SHOULD NOT take the reference +when it signifies to the caller that it has failed. + Tools for C formatting ======================