pgsql: printf("%lf") is not portable, so omit the "l".

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: printf("%lf") is not portable, so omit the "l".
Date: 2018-05-20 15:41:19
Message-ID: E1fKQSV-0001iP-Sb@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

printf("%lf") is not portable, so omit the "l".

The "l" (ell) width spec means something in the corresponding scanf usage,
but not here. While modern POSIX says that applying "l" to "f" and other
floating format specs is a no-op, SUSv2 says it's undefined. Buildfarm
experience says that some old compilers emit warnings about it, and at
least one old stdio implementation (mingw's "ANSI" option) actually
produces wrong answers and/or crashes.

Discussion: https://postgr.es/m/21670.1526769114@sss.pgh.pa.us
Discussion: https://postgr.es/m/c085e1da-0d64-1c15-242d-c921f32e0d5c@dunslane.net

Branch
------
REL9_3_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0aa97b86f9021f2d4a5cd1aab04e0d33794d120b

Modified Files
--------------
doc/src/sgml/ecpg.sgml | 2 +-
src/interfaces/ecpg/test/compat_informix/sqlda.pgc | 2 +-
src/interfaces/ecpg/test/expected/compat_informix-sqlda.c | 2 +-
src/interfaces/ecpg/test/expected/preproc-outofscope.c | 2 +-
src/interfaces/ecpg/test/expected/sql-sqlda.c | 2 +-
src/interfaces/ecpg/test/preproc/outofscope.pgc | 2 +-
src/interfaces/ecpg/test/sql/sqlda.pgc | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-05-20 22:06:49 pgsql: Fix unportable usage of printf("%m").
Previous Message Tom Lane 2018-05-19 20:04:57 pgsql: Assorted minor cleanups for bootstrap-data Perl scripts.