Date: Wed, 16 Feb 2005 02:16:01 +0100 From: Pav Lucistnik <pav@FreeBSD.org> To: freebsd-amd64@FreeBSD.org Subject: va_list fun Message-ID: <1108516561.1564.4.camel@hood.oook.cz>
next in thread | raw e-mail | index | archive | help
--=-YZpOLdAn7CzetaVa6D0U Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Someone please explain to me what I'm doing wrong: [legrace.c] #include <stdio.h> #include <stdarg.h> void funny(char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stdout, format, ap); vfprintf(stdout, format, ap); vfprintf(stdout, format, ap); vfprintf(stdout, format, ap); vfprintf(stdout, format, ap); va_end(ap); } int main(int argc, char *argv[]) { funny("%s\n", "string"); } [my 4-STABLE/i386 from Dec 2 2004] $ gcc legrace.c=20 $ ./a.out=20 string string string string string [my 5-STABLE/i386 from Jan 3 2005] $ gcc -O legrace.c=20 $ ./a.out=20 string string string string string [my 5-STABLE/amd64 from Feb 10 2005] $ gcc legrace.c $ ./a.out string =E7=FF=FF=FF Segmentation fault (core dumped) [sledge.freebsd.org] $ gcc legrace.c=20 $ ./a.out=20 string =F0=EC=FF=FF=FF Segmentation fault (core dumped) [pluto2.freebsd.org] $ gcc legrace.c=20 $ ./a.out=20 string string string string string --=20 Pav Lucistnik <pav@oook.cz> <pav@FreeBSD.org> 94 outdated ports on the box, 94 outdated ports. Portupgrade one, an hour 'til done, 82 outdated ports on the box. --=-YZpOLdAn7CzetaVa6D0U Content-Type: application/pgp-signature; name=signature.asc Content-Description: Toto je =?iso-8859-2?Q?digit=E1ln=EC?= =?ISO-8859-1?Q?_podepsan=E1?= =?iso-8859-2?Q?_=E8=E1st?= =?ISO-8859-1?Q?_zpr=E1vy?= -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQBCEp7RntdYP8FOsoIRAgClAJsHfAVyDah4LQk+5zTz9RwzhSFyDwCgjaC+ 1ChxPklSfb41Ks23pREQACE= =H/NS -----END PGP SIGNATURE----- --=-YZpOLdAn7CzetaVa6D0U--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1108516561.1564.4.camel>