]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
a68: add coding guideline on enquiry clauses
authorJose E. Marchesi <jemarch@gnu.org>
Wed, 11 Feb 2026 22:03:44 +0000 (23:03 +0100)
committerJose E. Marchesi <jemarch@gnu.org>
Wed, 11 Feb 2026 22:03:44 +0000 (23:03 +0100)
Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog

* ga68-coding-guidelines.texi (Enquiry clauses): New section.

gcc/algol68/ga68-coding-guidelines.texi

index ee68d7ae8536713e5ded95d5262ff9da58cfe2de..ef0bcfc4acc4e5e8d9c0e8c550a03ce01ac1e058 100644 (file)
@@ -773,6 +773,7 @@ facilities of the language.
 
 @menu
 * Writing routines::
+* Enquiry clauses::
 * Nihils::
 @end menu
 
@@ -813,6 +814,31 @@ it may be wise to judiciously pass those non-nearby values as
 arguments in order that the programmer be aware that non-nearby values
 are being accessed or possibly altered.
 
+@node Enquiry clauses
+@section Enquiry clauses
+
+@dfn{Enquiry clauses} are not just ``boolean expressions'' with a
+fancy name.  They can be thought as a sort of specialized serial
+clauses, and as such they can contain any number of declarations and
+units while being required to always yield a value of mode
+@code{bool}.
+
+Avoid polluting the lexical environment with declarations that are
+intended to be used exclusively within conditional and loop clauses:
+use a declaration in the enquiry-clause of the clause instead.  This
+also makes it easier to later refactor code.
+
+Examples:
+
+@example
+@{ The range of `c' is the entire loop clause. @}
+while char c = getchar;
+      c /= char_eof
+do
+   ... use c ...
+od
+@end example
+
 @node Nihils
 @section Nihils