This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "C" character set (again)


On Jan  8 09:05, Eric Blake wrote:
> According to Thomas Wolff on 1/8/2010 8:53 AM:
> >> Per POSIX, printf is only defined if you pass a valid character string
> >> as the format.
> > Based on what?
> 
> Based on the definition of "character string".  POSIX only defines printf
> if you pass a character string.  If you don't pass a valid a valid
> character string, then you are no longer under the rules of POSIX.
> >> That's why your behavior was undefined, and so ANYTHING can happen 
> > No, not quite anything, APIs are not pure maths, Return Value conditions
> > still have to be met.
> 
> No.  The point of undefined is that the return value is no longer
> relevant.  The same is true if you call printf(NULL).  That is undefined
> (NULL is not a valid character string).  Some platforms give a return
> value and set errno to EFAULT, others trigger a SEGFAULT, and some might
> even proceed to print whatever is in memory at address 0 (and that is just
> three typical behaviors, others can be imagined).  But you can't guarantee
> which, nor can POSIX standardize it, because it is UNDEFINED - you passed
> in an invalid argument, so expect the unexpected.

I was just about to give in and revert C to ASCII and now you're making
me unsure again in the opposite way.  <pout>That's not fair!!!</pout>


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]