Module Name:    src
Committed By:   rillig
Date:           Sun Jan 15 14:00:09 UTC 2023

Modified Files:
        src/tests/usr.bin/xlint/lint1: queries.c

Log Message:
tests/lint: document conversion from void pointer


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/queries.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/queries.c
diff -u src/tests/usr.bin/xlint/lint1/queries.c:1.8 src/tests/usr.bin/xlint/lint1/queries.c:1.9
--- src/tests/usr.bin/xlint/lint1/queries.c:1.8	Sun Jan  8 18:37:12 2023
+++ src/tests/usr.bin/xlint/lint1/queries.c	Sun Jan 15 14:00:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: queries.c,v 1.8 2023/01/08 18:37:12 rillig Exp $	*/
+/*	$NetBSD: queries.c,v 1.9 2023/01/15 14:00:09 rillig Exp $	*/
 # 3 "queries.c"
 
 /*
@@ -247,6 +247,12 @@ Q7(void)
 	c64 = (c64_t)f32;
 
 
+	/*
+	 * Converting a void pointer type to an object pointer type requires
+	 * an explicit cast in C++, as it is a narrowing conversion. In C,
+	 * that conversion is done implicitly.
+	 */
+
 	/* expect+1: redundant cast from 'pointer to void' to 'pointer to char' before assignment [Q7] */
 	str = (char *)allocate();
 	/* expect+1: redundant cast from 'pointer to void' to 'pointer to const char' before assignment [Q7] */

Reply via email to