[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: m4 bug in format.c (m4 v1.4)
From: |
Gary V . Vaughan |
Subject: |
Re: m4 bug in format.c (m4 v1.4) |
Date: |
Sun, 8 Apr 2001 01:04:09 +0100 |
On Friday 06 April 2001 8:06 am, address@hidden wrote:
> Version:
> m4 version 1.4, all operating systems
>
> Problem description:
>
> The format macro returns a wrong output if you specif an integer number
that terminates with a 0, example try to output the number 10 using:
> > format(%f, 10)
>
> 1000000
Agreed. Thanks for the patch -- applied to CVS HEAD.
> One thing I don't understand is why the format command has an own
> implementation, wouldn't it be better to simply use vsprintf() instead ? My
> guess is that vsprintf() is not implemented or not consistent on all
> operating systems ?
There is no portable way to build a va_list in memory to pass to vsprintf --
building an array of void* works with some compilers, provided the memory
alignment expected on the call stack matches the alignment of the array on
the heap. Worse, some compilers implement va_list's without using void*
arrays at all.
Cheers,
Gary.
--
___ _ ___ __ _ mailto: address@hidden
/ __|__ _ _ ___ _| | / / | / /_ _ _ _ __ _| |_ __ _ ___ address@hidden
| (_ / _` | '_|// / |/ /| |/ / _` | || / _` | ' \/ _` | _ \
\___\__,_|_|\_, /|___(_)___/\__,_|\_,_\__, |_||_\__,_|//_/
home page: /___/ /___/ gpg public key:
http://www.oranda.demon.co.uk http://www.oranda.demon.co.uk/key.asc