summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorPaul Herman <paulherman@google.com>2022-10-16 18:54:30 +0200
committerLinus Groh <mail@linusgroh.de>2022-10-16 22:05:42 +0200
commitd989c50c90237e3f87f32e69e26da64dcec0947a (patch)
treea24f525dd64a670528bc414e0ab6b4d8327caa5f /AK
parent9fad23018a02eb9de0949b3f65e20e41bc8cdd29 (diff)
downloadserenity-d989c50c90237e3f87f32e69e26da64dcec0947a.zip
AK: Document the non-standard extensions in TRY
I'm not sure there's a material improvement from this patch. However, I've been reading the error handling code from multiple projects and was excited to see Serenity being able to handle assignment (`auto x = TRY(make_x())`) the same way as actions (`TRY(do_x())`). I think it's worth documenting that this is only possible due to non-standard extensions.
Diffstat (limited to 'AK')
-rw-r--r--AK/Try.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/AK/Try.h b/AK/Try.h
index b1364125e8..58be3a64a3 100644
--- a/AK/Try.h
+++ b/AK/Try.h
@@ -8,6 +8,11 @@
// NOTE: This macro works with any result type that has the expected APIs.
// It's designed with AK::Result and AK::Error in mind.
+//
+// It depends on a non-standard C++ extension, specifically
+// on statement expressions [1]. This is known to be implemented
+// by at least clang and gcc.
+// [1] https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
#define TRY(expression) \
({ \