summaryrefslogtreecommitdiffstats
path: root/share/man/man3/stdarg.3
diff options
context:
space:
mode:
authorjmacd <jmacd@FreeBSD.org>1997-01-30 10:22:00 +0000
committerjmacd <jmacd@FreeBSD.org>1997-01-30 10:22:00 +0000
commit45f2876f9b408d85c389dc68c2a58254eec25f45 (patch)
tree198bc2e6e0bdafc79d5e6bda41ac2c33b0383875 /share/man/man3/stdarg.3
parent0988434e5dc03c34f02e712f48e3cd9f66e8443e (diff)
downloadFreeBSD-src-45f2876f9b408d85c389dc68c2a58254eec25f45.zip
FreeBSD-src-45f2876f9b408d85c389dc68c2a58254eec25f45.tar.gz
I just found a bug in my program, I was calling va_arg (..., char),
when parsing a printf-like arg list. Looking for someone to blame, I noticed that the man page has a bad example. It clearly says at the top that types following the last known argument are passed after their default type conversions, and then later the example uses va_arg (..., char); so I fixed it.
Diffstat (limited to 'share/man/man3/stdarg.3')
-rw-r--r--share/man/man3/stdarg.33
1 files changed, 2 insertions, 1 deletions
diff --git a/share/man/man3/stdarg.3 b/share/man/man3/stdarg.3
index 3b9a820..16876a1 100644
--- a/share/man/man3/stdarg.3
+++ b/share/man/man3/stdarg.3
@@ -163,7 +163,8 @@ void foo(char *fmt, ...)
printf("int %d\en", d);
break;
case 'c': /* char */
- c = va_arg(ap, char);
+ /* Note: char is promoted to int. */
+ c = va_arg(ap, int);
printf("char %c\en", c);
break;
}
OpenPOWER on IntegriCloud