summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-08-04 09:39:56 +0200
committerRichard Braun <rbraun@sceen.net>2017-08-04 09:39:56 +0200
commitf2a072f2a8ebaca76fa3f5b5fdb828b33c93e3e0 (patch)
treec622e75ce8bf0a8a9efd3593fd5abaf45b62722b
parente672836cb003dc1ae94fc3cfc489764675b52111 (diff)
doc/style(9): forbid declaring arguments as arrays
-rw-r--r--doc/style.9.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/style.9.txt b/doc/style.9.txt
index c61bc777..e479c8ca 100644
--- a/doc/style.9.txt
+++ b/doc/style.9.txt
@@ -548,6 +548,18 @@ with link-time optimizations (LTO), public functions can also be inlined
or even removed if unused. As a result, use inline for a few performance
critical short functions only.
+Passing arrays as arguments
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The C language automatically converts arrays to pointers when passed as
+function arguments. As a result, declaring an argument as an array is
+misleading. In particular, it may give the impression that the sizeof
+operator may be used safely to get the size of the array, when it
+actually always returns the size of a pointer. Therefore, declaring
+arguments as arrays is strictly forbidden.
+
+TODO Fix historic array argument declarations.
+
GIT COMMITS
-----------