Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
%p and casting
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Jack Klein, post: 1676519"] Yes, of course, and this has been true since ANSI89/ISO90. But there is neither requirement nor guarantee in the standard that pointer to void and pointer to char are passed to functions in the same way, whether the functions are variadic or not. gcc is taking advantage of its knowledge that it passes pointer to void and pointer to char in the same way, and therefore the result will be identical. I doubt that there are many, or even any, implementations that pass the two pointer types differently but nothing in the standard forbids it, and such an implementation would be conforming. So the behavior is undefined, as the standard says about all mismatches between *printf() conversion specifiers and arguments. As we often maintain here, even the fact that every single compiler in existence, past present and future, performs exactly the same for a specific instance of undefined behavior does not make the behavior defined. -- Jack Klein Home: [URL]http://JK-Technology.Com[/URL] FAQs for comp.lang.c [URL]http://www.eskimo.com/~scs/C-faq/top.html[/URL] comp.lang.c++ [URL]http://www.parashift.com/c++-faq-lite/[/URL] alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
%p and casting
Top