|
2018-04-07
| ||
| 14:57 | • Closed ticket [2b6a4fa5ed]: Tcl_ObjPrintf does not print wide ints with %ld ... artifact: 01e396e0dc user: dgp | |
|
2015-12-09
| ||
| 17:50 | • Ticket [2b6a4fa5ed]: 3 changes artifact: c5c049c346 user: dgp | |
| 17:43 | • Ticket [2b6a4fa5ed]: 4 changes artifact: 5c82894dca user: dgp | |
| 03:54 | • New ticket [2b6a4fa5ed]. artifact: ff7117aebf user: apnadkarni | |
Tcl_ObjPrintf does not print wide ints with %ld
Closed / Fixed2b6a4fa5ed30b44364b1cb31aa8aa574e9b003a0Created 11 years agoUpdated 9 years ago
Descriptionplain2015-12-09 03:54:09
Using the %ld specifier and passing in a wide int results in printing of only the low 32 bits (possibly the high 32 on big endian machines). The man page says: "The formatting is done with the same core formatting engine used by Tcl_Format. This means the set of supported conversion specifiers is that of the format command..." Both format and Tcl_Format handle %ld correctly which implies Tcl_ObjPrintf should as well but it does not.
dgpplain2015-12-09 17:43:59
http://core.tcl.tk/tcl/artifact/24d36182565d6b2b?ln=2586
dgpplain2015-12-09 17:50:44
This is tricky because the *Printf formatting specs control memory access issues as well as formatting, so you need 4 distinctions to cover the cases (read the argument as int, long, Tcl_WideInt, mp_int), and the [format] engine only supplies 3. What's been done up to now is to make *Printf so what the printf() system calls do.
dgpplain2018-04-07 14:57:15
TIP 476 corrects this in Tcl 8.7.
Log in (anonymous is fine) to add a comment.