[LLVMbugs] [Bug 20876] -Wformat should maybe allow precision for %Z
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Sep 8 08:51:37 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20876
Nico Weber <nicolasweber at gmx.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |WONTFIX
--- Comment #5 from Nico Weber <nicolasweber at gmx.de> ---
#include <stdio.h>
#include <string.h>
struct ANSI_STRING {
unsigned short len;
unsigned short maxlen;
char* buf;
};
int main() {
char buf[] = "hello there";
ANSI_STRING s = { strlen(buf), sizeof(buf), buf };
printf("%4.4Z\n", &s);
printf("%4.4s\n", s.buf);
}
has output
D:\src\chromefetch\src>test
hello there
hell
So precision is in fact ignored for %Z arguments. So clang's right here, and
chromium's code is incorrect.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140908/b8bfd89e/attachment.html>
More information about the llvm-bugs
mailing list