Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9c515f7

Browse files
committed
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
1 parent 22d22e4 commit 9c515f7

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed

doc/src/sgml/ecpg.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1646,7 +1646,7 @@ while (1)
16461646
<para>
16471647
Here is an example using the data type <type>complex</type> from
16481648
the example in <xref linkend="xtypes">. The external string
1649-
representation of that type is <literal>(%lf,%lf)</literal>,
1649+
representation of that type is <literal>(%f,%f)</literal>,
16501650
which is defined in the
16511651
functions <function>complex_in()</function>
16521652
and <function>complex_out()</function> functions

src/interfaces/ecpg/test/compat_informix/sqlda.pgc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dump_sqlda(sqlda_t *sqlda)
3737
printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname, *(int *)sqlda->sqlvar[i].sqldata);
3838
break;
3939
case SQLFLOAT:
40-
printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
40+
printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
4141
break;
4242
case SQLDECIMAL:
4343
{

src/interfaces/ecpg/test/expected/compat_informix-sqlda.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ dump_sqlda(sqlda_t *sqlda)
142142
printf("name sqlda descriptor: '%s' value %d\n", sqlda->sqlvar[i].sqlname, *(int *)sqlda->sqlvar[i].sqldata);
143143
break;
144144
case SQLFLOAT:
145-
printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
145+
printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname, *(double *)sqlda->sqlvar[i].sqldata);
146146
break;
147147
case SQLDECIMAL:
148148
{

src/interfaces/ecpg/test/expected/preproc-outofscope.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ if (sqlca.sqlcode < 0) exit (1);}
337337
get_record1();
338338
if (sqlca.sqlcode == ECPG_NOT_FOUND)
339339
break;
340-
printf("id=%d%s t='%s'%s d1=%lf%s d2=%lf%s c = '%s'%s\n",
340+
printf("id=%d%s t='%s'%s d1=%f%s d2=%f%s c = '%s'%s\n",
341341
myvar->id, mynullvar->id ? " (NULL)" : "",
342342
myvar->t, mynullvar->t ? " (NULL)" : "",
343343
myvar->d1, mynullvar->d1 ? " (NULL)" : "",

src/interfaces/ecpg/test/expected/sql-sqlda.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ dump_sqlda(sqlda_t *sqlda)
158158
break;
159159
#endif
160160
case ECPGt_double:
161-
printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata);
161+
printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata);
162162
break;
163163
case ECPGt_numeric:
164164
{

src/interfaces/ecpg/test/preproc/outofscope.pgc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ main (void)
101101
get_record1();
102102
if (sqlca.sqlcode == ECPG_NOT_FOUND)
103103
break;
104-
printf("id=%d%s t='%s'%s d1=%lf%s d2=%lf%s c = '%s'%s\n",
104+
printf("id=%d%s t='%s'%s d1=%f%s d2=%f%s c = '%s'%s\n",
105105
myvar->id, mynullvar->id ? " (NULL)" : "",
106106
myvar->t, mynullvar->t ? " (NULL)" : "",
107107
myvar->d1, mynullvar->d1 ? " (NULL)" : "",

src/interfaces/ecpg/test/sql/sqlda.pgc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dump_sqlda(sqlda_t *sqlda)
4545
break;
4646
#endif
4747
case ECPGt_double:
48-
printf("name sqlda descriptor: '%s' value %lf\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata);
48+
printf("name sqlda descriptor: '%s' value %f\n", sqlda->sqlvar[i].sqlname.data, *(double *)sqlda->sqlvar[i].sqldata);
4949
break;
5050
case ECPGt_numeric:
5151
{

0 commit comments

Comments
 (0)