Gah; my mistake -- that va_end(fmt) should be va_end(list). It works for me with gcc 4.9.1 and icc:
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.2.164 Build 20150121 > On Mar 12, 2015, at 7:40 PM, Fabricio Cannini <fcann...@gmail.com> wrote: > > On 12-03-2015 20:24, Jeff Squyres (jsquyres) wrote: >> include <stdio.h> >> #include <stdarg.h> >> >> static void foo(const char *fmt, ...) >> { >> va_list list; >> va_start(list, fmt); >> vprintf(fmt, list); >> va_end(fmt); >> } >> >> int main() >> { >> foo("%s %s\n", "hello", "world"); >> } > > Thanks for the code, Jeff. > > icc won't even compile it, barfs with the following error message: > =========================================== > foo.c(9): error: incorrect use of va_end > va_end(fmt); > ^ > > compilation aborted for foo.c (code 2) > =========================================== > > > This means i should update icc, right ? > > > [ ]'s > _______________________________________________ > users mailing list > us...@open-mpi.org > Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users > Link to this post: > http://www.open-mpi.org/community/lists/users/2015/03/26460.php -- Jeff Squyres jsquy...@cisco.com For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/