[LLVMbugs] [Bug 11152] New: suggest %zu for size_t args to printf, at least in c99 mode

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 17 01:48:33 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=11152

           Summary: suggest %zu for size_t args to printf, at least in c99
                    mode
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hans at chromium.org
                CC: llvmbugs at cs.uiuc.edu


For the following program:

#include <stdio.h>

void f(size_t a) {
  printf("%c", a);
}

Clang suggests this:

/tmp/a.c:4:12: warning: conversion specifies type 'int' but the argument has
      type 'size_t' (aka 'unsigned long') [-Wformat]
  printf("%c", a);
          ~^   ~
          %lu


It would be better if it suggested %zu, at least in C99 (and C++11).

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list