postgres.git / summary / log / commit / refs
commit fa2cfb962c05df730f6bf586614eb39a4b0b5238
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Sun May 20 15:40:54 2018 +0000
First released in: 11.0, 9.3.24, 9.4.19, 9.5.14, 9.6.10, 10.5
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
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(-)
diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml
index 5380f45bd15..741d6d38159 100644
--- a/doc/src/sgml/ecpg.sgml
+++ b/doc/src/sgml/ecpg.sgml
@@ -1678,7 +1678,7 @@ while (1)
<para>
Here is an example using the data type <type>complex</type> from
the example in <xref linkend="xtypes">. The external string
- representation of that type is <literal>(%lf,%lf)</literal>,
+ representation of that type is <literal>(%f,%f)</literal>,
which is defined in the
functions <function>complex_in()</function>
and <function>complex_out()</function> functions
diff --git a/src/interfaces/ecpg/test/compat_informix/sqlda.pgc b/src/interfaces/ecpg/test/compat_informix/sqlda.pgc
index e1142d2b220..de0af58ec88 100644
--- a/src/interfaces/ecpg/test/compat_informix/sqlda.pgc
+++ b/src/interfaces/ecpg/test/compat_informix/sqlda.pgc
@@ -37,7 +37,7 @@ dump_sqlda(sqlda_t *sqlda)
printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname, *(int *)sqlda->sqlvar[i].sqldata);
break;
case SQLFLOAT:
- printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
+ printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
break;
case SQLDECIMAL:
{
diff --git a/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
index 1df87f83ef0..dd6d89166f1 100644
--- a/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
+++ b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
@@ -142,7 +142,7 @@ dump_sqlda(sqlda_t *sqlda)
printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname, *(int *)sqlda->sqlvar[i].sqldata);
break;
case SQLFLOAT:
- printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
+ printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
break;
case SQLDECIMAL:
{
diff --git a/src/interfaces/ecpg/test/expected/preproc-outofscope.c b/src/interfaces/ecpg/test/expected/preproc-outofscope.c
index b3deb221d74..b9522a76abb 100644
--- a/src/interfaces/ecpg/test/expected/preproc-outofscope.c
+++ b/src/interfaces/ecpg/test/expected/preproc-outofscope.c
@@ -337,7 +337,7 @@ if (sqlca.sqlcode < 0) exit (1);}
get_record1();
if (sqlca.sqlcode == ECPG_NOT_FOUND)
break;
- printf("id=%d%s t='%s'%s d1=%lf%s d2=%lf%s c = '%s'%s\n",
+ printf("id=%d%s t='%s'%s d1=%f%s d2=%f%s c = '%s'%s\n",
myvar->id, mynullvar->id ? " (NULL)" : "",
myvar->t, mynullvar->t ? " (NULL)" : "",
myvar->d1, mynullvar->d1 ? " (NULL)" : "",
diff --git a/src/interfaces/ecpg/test/expected/sql-sqlda.c b/src/interfaces/ecpg/test/expected/sql-sqlda.c
index b8d91805c97..96386e89894 100644
--- a/src/interfaces/ecpg/test/expected/sql-sqlda.c
+++ b/src/interfaces/ecpg/test/expected/sql-sqlda.c
@@ -158,7 +158,7 @@ dump_sqlda(sqlda_t *sqlda)
break;
#endif
case ECPGt_double:
- printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata);
+ printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata);
break;
case ECPGt_numeric:
{
diff --git a/src/interfaces/ecpg/test/preproc/outofscope.pgc b/src/interfaces/ecpg/test/preproc/outofscope.pgc
index 6b5d2707cef..63221147296 100644
--- a/src/interfaces/ecpg/test/preproc/outofscope.pgc
+++ b/src/interfaces/ecpg/test/preproc/outofscope.pgc
@@ -101,7 +101,7 @@ main (void)
get_record1();
if (sqlca.sqlcode == ECPG_NOT_FOUND)
break;
- printf("id=%d%s t='%s'%s d1=%lf%s d2=%lf%s c = '%s'%s\n",
+ printf("id=%d%s t='%s'%s d1=%f%s d2=%f%s c = '%s'%s\n",
myvar->id, mynullvar->id ? " (NULL)" : "",
myvar->t, mynullvar->t ? " (NULL)" : "",
myvar->d1, mynullvar->d1 ? " (NULL)" : "",
diff --git a/src/interfaces/ecpg/test/sql/sqlda.pgc b/src/interfaces/ecpg/test/sql/sqlda.pgc
index d99f7f7e960..67f14d6ccb8 100644
--- a/src/interfaces/ecpg/test/sql/sqlda.pgc
+++ b/src/interfaces/ecpg/test/sql/sqlda.pgc
@@ -45,7 +45,7 @@ dump_sqlda(sqlda_t *sqlda)
break;
#endif
case ECPGt_double:
- printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata);
+ printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata);
break;
case ECPGt_numeric:
{
[parent: a5be529aaade]