This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug c/69605] New: printf %f on integers


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69605

            Bug ID: 69605
           Summary: printf %f on integers
           Product: gcc
           Version: 4.8.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: elmerido at yopmail dot com
  Target Milestone: ---

#include<stdio.h>
int main() {
        printf("a= %f \n",3.14);
        printf("b= %f \n",200);
        return 0;
}

returns :
a= 3.140000 
b= 3.140000 

Compilation gives warning but still generates the binary :
i.c: In function âmainâ:
i.c:6:2: warning: format â%fâ expects argument of type âdoubleâ, but argument 2
has type âintâ [-Wformat=]
  printf("b= %f \n",200);
  ^

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