From: Alejandro Colomar <colomar.6.4.3@gmail.com>
To: mtk.manpages@gmail.com, eggert@cs.ucla.edu, David.Laight@ACULAB.COM
Cc: Alejandro Colomar <colomar.6.4.3@gmail.com>,
linux-man@vger.kernel.org, gcc-patches@gcc.gnu.org,
libc-alpha@sourceware.org, linux-kernel@vger.kernel.org
Subject: [PATCH] system_data_types.7: void *: Add info about generic function parameters and return value
Date: Fri, 2 Oct 2020 11:43:16 +0200 [thread overview]
Message-ID: <20201002094315.17832-1-colomar.6.4.3@gmail.com> (raw)
Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Reported-by: David Laight <David.Laight@ACULAB.COM>
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.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
reply other threads:[~2020-10-02 9:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201002094315.17832-1-colomar.6.4.3@gmail.com \
--to=colomar.6.4.3@gmail.com \
--cc=David.Laight@ACULAB.COM \
--cc=eggert@cs.ucla.edu \
--cc=gcc-patches@gcc.gnu.org \
--cc=libc-alpha@sourceware.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).