Question regarding prototypes for 0-ary functions.

  • Thread starter João Jerónimo
  • Start date
K

Kaz Kylheku

Basically, yes. Except that this is done on an implementation where
unprototyped functions don't use the same calling convention as prototyped
variadic functions.

Then it isn't going to work. A conforming program will call printf as a
prototyped function, and the call will break due to different calling
conventions, right?
(And my point was that the standard might not
specifically disallow it, but if it doesn't, since the only way to use

The standard doesn't disallow broken, incomplete, or otherwise nonconforming
libraries. Such implementations can't claim to be conforming hosted
implementations, but at most conforming freestanding ones. They don't support
programs that require the features hosted implementations.
printf would be by avoiding <stdio.h> and the correct declaration, it
would be absurd for an implementation to try this.)

A program that calls printf other than using the correct declaration is
nonconforming. That the program has to do this in order to get the call
to work shows that the implementation is nonconforming.

The standard describes a protocol for calling printf, but this program and
implementation use a different arrangement. It si outside of the scope of the
standard language entirely.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,833
Latest member
BettyeMacf

Latest Threads

Top