printf("%lf",...) isn't actually portable

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: printf("%lf",...) isn't actually portable
Date: 2018-05-19 22:31:54
Message-ID: 21670.1526769114@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I noticed while poking at the recent ecpg unpleasantness that some
of my older critters were warning about use of %lf conversions in
printf. Looking into it, I find that current POSIX says the "l"
is a no-op, while SUSv2 says it's undefined. I think this usage
got into our code as a result of people making false analogies
between scanf and printf conversions.

I think we should just switch these to plain %f, as per attached.

regards, tom lane

Attachment Content-Type Size
remove-unportable-lf-format-specs.patch text/x-diff 5.5 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2018-05-19 22:33:22 Fix for FETCH FIRST syntax problems
Previous Message Tom Lane 2018-05-19 20:05:48 Re: FindDefinedSymbol() is subtly broken