Project

General

Profile

Actions

Bug #13315

closed

Single "%" at the end of `printf` format string appears in the result

Added by nobu (Nobuyoshi Nakada) about 7 years ago. Updated over 6 years ago.

Status:
Closed
Target version:
-
[ruby-core:80153]

Description

Is this intentional?

printf("%") #=> "%"

printf in glibc does print nothing, gcc warns though.

#include <stdio.h>

int main(void)
{
  printf("%");
  return 0;
}
$ gcc fmt.c && ./a.out 
fmt.c: In function ‘main’:
fmt.c:5:10: warning: spurious trailing ‘%’ in format [-Wformat=]
   printf("%");
          ^

printf command of bash errs.

$ printf "%"
-bash: printf: `%': missing format character
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0