]> granicus.if.org Git - postgresql/commitdiff
printf("%lf") is not portable, so omit the "l".
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 20 May 2018 15:40:54 +0000 (11:40 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 20 May 2018 15:40:54 +0000 (11:40 -0400)
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
src/interfaces/ecpg/test/compat_informix/sqlda.pgc
src/interfaces/ecpg/test/expected/compat_informix-sqlda.c
src/interfaces/ecpg/test/expected/preproc-outofscope.c
src/interfaces/ecpg/test/expected/sql-sqlda.c
src/interfaces/ecpg/test/preproc/outofscope.pgc
src/interfaces/ecpg/test/sql/sqlda.pgc

index 5380f45bd151a7ef8bba51fdf953fa03b0273182..741d6d38159cb9357726ac7adbb61e895b2dfe31 100644 (file)
@@ -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
index e1142d2b2203cd2b8b826d0714d8b55ddf9ec158..de0af58ec889695b7208388d097946985703b034 100644 (file)
@@ -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:
                        {
index 1df87f83ef065084c01fbf4b4fc9b3f70c4bb59b..dd6d89166f1fdb4e7cc06bba13258edc77e7c3bc 100644 (file)
@@ -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:
                        {
index b3deb221d74969aedee369bfdba4d3d95c2ec83f..b9522a76abb81d05a7d076280f3a98d44d808a94 100644 (file)
@@ -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)" : "",
index b8d91805c97de3df7390ab40d83f302c15ef22e2..96386e8989412b0aa2ba9a8d36927e4ad36baa01 100644 (file)
@@ -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:
                        {
index 6b5d2707cef651bf9f7ea36a8dc2e35c59516adf..6322114729684b3701046cec7e3bb7e4b6bcb78b 100644 (file)
@@ -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)" : "",
index d99f7f7e960f8dc4eca4b41d1fa1ae691512bc63..67f14d6ccb85d7d28a1852edfdc6fee9fbfaea04 100644 (file)
@@ -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:
                        {