Linux-man Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] system_data_types.7: void *: Add info about generic function parameters and return value
@ 2020-10-02  9:43 Alejandro Colomar
  0 siblings, 0 replies; only message in thread
From: Alejandro Colomar @ 2020-10-02  9:43 UTC (permalink / raw)
  To: mtk.manpages, eggert, David.Laight
  Cc: Alejandro Colomar, linux-man, gcc-patches, libc-alpha, linux-kernel

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-02  9:43 [PATCH] system_data_types.7: void *: Add info about generic function parameters and return value Alejandro Colomar

Linux-man Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-man/0 linux-man/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-man linux-man/ https://lore.kernel.org/linux-man \
		linux-man@vger.kernel.org
	public-inbox-index linux-man

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-man


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git