develooper Front page | perl.perl5.porters | Postings from August 2016

Re: Concerning 5862f7: perlguts: Note how to print Size_t, SSize_t

Thread Previous | Thread Next
From:
John P. Linderman
Date:
August 10, 2016 17:20
Subject:
Re: Concerning 5862f7: perlguts: Note how to print Size_t, SSize_t
Message ID:
CAC0cEp9U0pywwDMTwGGFevxzE2cyzY-rEFZ9-hTNL_Y=ygJMNQ@mail.gmail.com
I interrupt the serious work for a related anecdote. When I was working for
Bell Labs, we were forced to use a 3B in-house product for a project where
we would much rather have used a VAX. The 3B looked like a rack of
switching equipment, which it pretty much *was*. Switches didn't need
floating point, so the 3B didn't have it. I wanted to use awk (this was the
pre-Perl era, please don't judge me), and I discovered that simply by
changing the typedef of awkfloat to an int, everything compiled without
further change. *Except* for the format item used to print awkfloats. I had
to grub around and find a bunch of places where %g and %f appeared. ANSI C
was being kicked around at the time, so I mentioned to someone involved
that it sure would have been nice if adjacent string literals were
concatenated into a single string literal by the compiler. Then I could
have #defined a few literals for formatting awkfloats, and the awk code
would have been even more portable. And the ANSI C people bought it!

So maybe something similar could be done for formatting Size_t and SSize_t?

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About