autoconf
[Top][All Lists]
Advanced

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

Re: Question regarding sscanf() vs. off_t and similar


From: Philipp Marek
Subject: Re: Question regarding sscanf() vs. off_t and similar
Date: Thu, 14 Sep 2006 17:53:58 +0200
User-agent: KMail/1.9.3

On Thursday 14 September 2006 17:41 Andreas Schwab wrote:
> Philipp Marek <address@hidden> writes:
> > On Thursday 14 September 2006 15:01 Andreas Schwab wrote:
> >> Note that "L" is not a valid length modifier for integer formats.
> >
> > For gnu libc it is:
> > http://www.gnu.org/software/libc/manual/html_node/Integer-Conversions.htm
> >l#Integer-Conversions
> It's better not to depend on non-standard extensions when it is easy to
> avoid.
There you're right.

> >> Assuming you meant %llu instead of %Lu you can always add a cast to
> >> unsigned long long to match the format.
> >
> > Yes. But that's a bit unclean, and doing that unnecessarily in a loop for
> > ~300000 iterations is something I'd like to avoid.
>
> String formatting isn't exactly fast anyway, so the conversion would most
> likely be lost in the noise.

Trying the attached program seems to show that it makes up to 30% difference 
(in a microbenchmark - not in the real-world-scenario :-)

        $ cc -O6 -o pf pf.c
        $ ./pf
        stg=1799999

        diff = 1:018974
        diff = 1:340017
(Thats on an Duron 1200)

Thank you!


Regards,

Phil

-- 
Versioning your /etc, /home or even your whole installation?
             Try fsvs (fsvs.tigris.org)!

Attachment: Makefile
Description: Text Data

Attachment: pf.c
Description: Text Data


reply via email to

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