bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Printf type modifier wrong or incorrectly documented.


From: Ferreira Maurizio
Subject: Printf type modifier wrong or incorrectly documented.
Date: Thu, 25 Jan 2007 16:59:59 +0100

Seems that the type modifier L is handled incorrectly.
The following program shows garbage instead of the correct result

#include <stdio.h>
#include <stdint.h>

int main (void)
{
  int64_t  i,n;  // idem with long long int

  n = 1;
  for (i = 1; i <= 40; i++)
  {
    printf ("n= %Ld ----- div 1000= %Ld\n",  n, n/1000);
    n = n * 3;
  }
  return 0;
}

Replacing the printf line whith the following, gives the correct answer.

    printf ("n= %I64d ----- div 1000= %I64d\n",  n, n/1000);

I'm trying with mingw32 3.4.2
Is it a bug of libc or of the documentation ?
Regards
Maurizio Ferreira.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]