Search code examples
objective-ccprintfspecifier

C printf Format Specifier %_fi


Does anyone know if an underscore as format specifier (like %_f) does anything in C code? I+ve found some code in a book that uses it, but I've googled and found nothing. I've also tested the following Objective-C code in Xcode and Xcode seems not to support this specifier. Is it valid in C?

-(void) print {
    printf( "%_f + %_fi", real, imaginary );
}

Thanks!


Solution

  • The OS X man page for printf() says this:

    • An optional separator character ( , | ; | : | _ ) used for separating multiple values when printing an AltiVec or SSE vector, or other multi-value unit.

      NOTE: This is an extension to the printf() specification. Behaviour of these values for printf() is only defined for operating systems conforming to the AltiVec Technology Programming Interface Manual. (At time of writing this includes only Mac OS X 10.2 and later.)