Artifacts Associated With Ticket 31fedb885e801f4c
Ticket change [1a8b5f0699] (rid 238644) by emiliano on 2025-03-25 00:09:34:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
The man page documenting the Tcl functions Tcl_ExprLong(), Tcl_ExprDouble(), Tcl_ExprBoolean() and Tcl_ExprString() omits to mention that these four functions returns TCL_OK and write a zero in the passed in variable if an empty string is provided (*expr == '\0'). This is relevant since evaluating an empty string in Tcl results in a different result. $ tclsh9.1 % expr {} empty expression in expression "" - foundin initialized to: "trunk"
- is_private initialized to: "0"
- login: "emiliano"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "emiliano"
- subsystem initialized to: "69. Other"
- title initialized to: "Tcl_ExprLong documentation omission"
- type initialized to: "Bug"
Ticket change [04a31b4f0a] (rid 238717) by jan.nijtmans on 2025-03-26 19:54:44:
- icomment:
In the code, I see this: <pre> if (*exprstring == '\0') { /* * Legacy compatibility - return 0 for the zero-length string. */ *ptr = 0; } else { </pre> This tells me that this behavior was not intended, but kept for compatibility with old versions of Tcl. Wouldn't it be better to fix this behavior, generating an error-message in this case? - login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [ce90df7b29] (rid 238718) by apnadkarni on 2025-03-27 02:51:59:
- icomment:
While I too would prefer fixing this as opposed to changing the documentation, I fear that opportunity might have passed with 9.0 release depending on whether one believes manpages are authoritative or the actual implementation. Also, Tcl_ExprLongObj etc. may also have the same issue though I have not checked the actual behavior in those cases.
- login: "apnadkarni"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [d7e7e26cf2] (rid 238719) by jan.nijtmans on 2025-03-27 07:03:16:
- icomment:
Or ... just deprecate those functions in 9.1 and remove them in 9.2. Or ... deprecate those in 9.0 and remove them in 9.1 .... I only found 2 extensions still using any of those: Blt and Tix. > Also, Tcl_ExprLongObj etc. may also have the same issue though I have not checked the actual behavior in those cases. No, the *Obj() functions are OK, they - correctly - output an error-message in this case.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment: