On Thu, Jun 20, 2002 at 10:16:11AM -0700, David O'Brien wrote:
> > I have posted info about awk (which is nawk) incorrectly printing
> > numbers between 10 and 15. It adds ascii '0' to value.
>
> This is *NOT* a fix. nawk builds world just fine on my systems.
> Of course this leads one to wonder what is different about my systems and
> yours.
I'm trying to figure this too. Look at following program and it's output,
and please tell me what's wrong. It works as expected on -STABLE
and Linux.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int
main(int argc,char**argv)
{
double a;
int b;
char bb[100];
strcpy(bb,argv[1]);
printf("%lf\n",strtod(bb,NULL));
sscanf(bb,"%lf",&a);
printf("%lf\n",a);
sscanf(bb,"%f",&a);
printf("%f\n",a);
sscanf(bb,"%d",&b);
printf("%d\n",b);
return 0;
}
igorr@sysadm~> gcc -Wall qq.c
qq.c: In function `main':
qq.c:16: warning: float format, double arg (arg 3) <--- I have expected this
igorr@sysadm~> ./a.out 123
123.000000
0.124861
0.0<4861 <--- Pay attention
123
IIRC this worked fine in preGCC3.1 world.
--
Igor Roboul, System administrator at Speech Technology Center
http://www.speechpro.com http://www.speechpro.ru
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message