summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2017-09-11 14:47:15 -0400
committerPeter Eisentraut <peter_e@gmx.net>2017-09-11 14:47:15 -0400
commit3612019a7925012445af29b9ea7af84bd68a5932 (patch)
tree2c23ba09472e7f3e97564921d64bb7e314759222
parent821fb8cdbf700a8aadbe12d5b46ca4e61be5a8a8 (diff)
doc: Document function pointer source code style
as implemented in 1356f78ea93395c107cbc75dc923e29a0efccd8a
-rw-r--r--doc/src/sgml/sources.sgml18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/src/sgml/sources.sgml b/doc/src/sgml/sources.sgml
index 877fcedbb3a..7777bf51995 100644
--- a/doc/src/sgml/sources.sgml
+++ b/doc/src/sgml/sources.sgml
@@ -964,5 +964,23 @@ handle_sighup(SIGNAL_ARGS)
</para>
</simplesect>
+ <simplesect>
+ <title>Calling Function Pointers</title>
+
+ <para>
+ For clarity, it is preferred to explicitly dereference a function pointer
+ when calling the pointed-to function if the pointer is a simple variable,
+ for example:
+<programlisting>
+(*emit_log_hook) (edata);
+</programlisting>
+ (even though <literal>emit_log_hook(edata)</literal> would also work).
+ When the function pointer is part of a structure, then the extra
+ punctuation can and usually should be omitted, for example:
+<programlisting>
+paramInfo->paramFetch(paramInfo, paramId);
+</programlisting>
+ </para>
+ </simplesect>
</sect1>
</chapter>