Artifacts Associated With Ticket da6f155ca4
Ticket change [0969894470] (rid 196922) by chrstphrchvz on 2021-12-24 19:19:54:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
I don’t observe anything broken due to the lack of parentheses around <tt>numChars</tt> in the <tt>STRING_SIZE()</tt> macro, but would it be a good idea to parenthesize it anyway to avoid surprises? <pre> diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h index 25b854ea4..59e9499a7 100644 --- a/generic/tclStringRep.h +++ b/generic/tclStringRep.h @@ -67,7 +67,7 @@ typedef struct String { #define STRING_MAXCHARS \ (int)(((size_t)UINT_MAX - 1 - TclOffset(String, unicode))/sizeof(Tcl_UniChar)) #define STRING_SIZE(numChars) \ <span style="color:red">- (TclOffset(String, unicode) + ((numChars + 1) * sizeof(Tcl_UniChar)))</span> <span style="color:green">+ (TclOffset(String, unicode) + (((numChars) + 1) * sizeof(Tcl_UniChar)))</span> #define stringCheckLimits(numChars) \ do { \ if ((numChars) < 0 || (numChars) > STRING_MAXCHARS) { \ </pre> - foundin initialized to: "8.6.12"
- is_private initialized to: "0"
- login: "chrstphrchvz"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Cosmetic"
- status initialized to: "Open"
- submitter initialized to: "chrstphrchvz"
- subsystem initialized to: "10. Objects"
- title initialized to: "STRING_SIZE() macro: parenthesize numChars usage"
- type initialized to: "Patch"
Ticket change [044b2a74da] (rid 197024) by jan.nijtmans on 2022-01-12 21:15:59:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2459592.38610872"
- closer changed to: "jan.nijtmans"
- icomment:
Fixed [2bb7cd72c8c5f5a3|here]. Thanks for the report and the patch. This same commit fixes other similar macro's too.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"