lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20201002094315.17832-1-colomar.6.4.3@gmail.com>
Date:   Fri,  2 Oct 2020 11:43:16 +0200
From:   Alejandro Colomar <colomar.6.4.3@...il.com>
To:     mtk.manpages@...il.com, eggert@...ucla.edu, David.Laight@...LAB.COM
Cc:     Alejandro Colomar <colomar.6.4.3@...il.com>,
        linux-man@...r.kernel.org, gcc-patches@....gnu.org,
        libc-alpha@...rceware.org, linux-kernel@...r.kernel.org
Subject: [PATCH] system_data_types.7: void *: Add info about generic function parameters and return value

Reported-by: Paul Eggert <eggert@...ucla.edu>
Reported-by: David Laight <David.Laight@...LAB.COM>
Signed-off-by: Alejandro Colomar <colomar.6.4.3@...il.com>
---

Paul and David,
Thanks for your input!

Alex


 man7/system_data_types.7 | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/man7/system_data_types.7 b/man7/system_data_types.7
index aab64e002..6451782db 100644
--- a/man7/system_data_types.7
+++ b/man7/system_data_types.7
@@ -1903,6 +1903,16 @@ and back.
 .PP
 Conversions from and to any other pointer type are done implicitly,
 not requiring casts at all.
+Note that this feature prevents any kind of type checking:
+the programmer should be careful not to cast a
+.I void *
+value to a type incompatible to that of the underlying data,
+because that would result in undefined behavior.
+.PP
+This type is useful in function parameters and return value
+to allow passing values of any type.
+The function will usually use some mechanism to know
+of which type the underlying data passed to the function really is.
 .PP
 A value of this type can't be dereferenced,
 as it would give a value of type
@@ -1926,6 +1936,12 @@ values.
 Conforming to:
 C99 and later; POSIX.1-2001 and later.
 .PP
+See also:
+.BR malloc (3),
+.BR memcmp (3),
+.BR memcpy (3),
+.BR memset (3)
+.PP
 See also the
 .I intptr_t
 and
-- 
2.28.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ