Artifacts Associated With Ticket 8fb059e8ec2344cb
Ticket change [dd35a93d40] (rid 225290) by dgp on 2024-04-24 16:12:36:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Recent check-in [c6d3960498] included a large number of changes where a sentinel argument was changed from (void) NULL to (char *) NULL Would we get code maintenance benefit from a macro in a header file: #define TCL_SENTINEL (char *) NULL so we can make any similar future modifications in one place?
- is_private initialized to: "0"
- login: "dgp"
- priority initialized to: "5 Medium"
- private_contact initialized to: "8e2300e85be5dd1445b9666eb9429055951e33be"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "dgp"
- subsystem initialized to: "None"
- title initialized to: "macro for sentinels"
- type initialized to: "RFE"
Ticket change [724487369b] (rid 225321) by jan.nijtmans on 2024-04-25 09:55:03:
- icomment:
Actually, it was changed from (void *)NULL to (char *)NULL. The reason for this is just readability: It is used in functions like Tcl_SetErrorCode(), Tcl_AppendResult(), and Tcl_AppendStringsToObj(), which expect strings in all its elements. Using (char *)NULL makes it immediately clear that the last sentinel argument is a string too. Using TCL_SENTINEL would hide that information, I don't think we want that. In functions like mp_init_multi() sentinels are used as well, but there the arguments are not strings. Therefore (void *)NULL is kept there: It could have been changed to (mp_int *)NULL, but that looks more ugly. Just my 2c
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [91d2337634] (rid 225322) by chw on 2024-04-25 10:24:13:
- icomment:
Can't resist to throw my 2 cents into this debate. Few months ago we had a similar discussion about the cons and pros of TCL_UNUSED and my argument against it was information loss. Now, the use of TCL_SENTINEL is information loss, too, and arguably not favorable? Am I the only one who's somewhat puzzled?
- login: "chw"
- mimetype: "text/x-fossil-plain"
- icomment:
Ticket change [2180f6540b] (rid 225323) by jan.nijtmans on 2024-04-25 11:06:24:
- icomment:
lol. So you would prefer `TCL_SENTINEL(char *)` then ?? The difference with TCL_UNUSED is that C/C++ already has the standard construct `(type)NULL` for exactly what we want here. That 2 more cents, making 6 ;-)
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [765d922da8] (rid 225324) by chw on 2024-04-25 11:47:27:
- icomment:
Lemme be clear, neither do I like TCL_UNUSED, nor TCL_SENTINEL. Both hide in my irrelevant opinion information. But if that is culturally common sense, so be it and I need to get used to it and finally have to live with it.
- login: "chw"
- mimetype: "text/x-fossil-plain"
- icomment:
Ticket change [43ab95ceda] (rid 225325) by sebres on 2024-04-25 11:58:22:
- icomment:
Is it really necessary to switch cast from `(char *)NULL` to `(void *)NULL`?<br/> I mean isn't `void *` compatible with `(char *)NULL`? And from point of view the functions with variadic args like Tcl_AppendResult it is also the same thing.<br/> So let it be `(char *)NULL` everywhere - no changes across versions, no conflicts, no special sentinel macro needed...
- login: "sebres"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [371c2927d7] (rid 225326) by jan.nijtmans on 2024-04-25 12:05:09:
- icomment:
> So let it be (char *)NULL everywhere - no changes across versions, no conflicts, no special sentinel macro needed... Yes, that's the idea....
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [c22148638a] (rid 261551) by serhiy.storchaka on 2026-11-13 11:18:45:
- closedate changed to: "2461357.9713335303"
- closer changed to: "serhiy.storchaka"
- icomment:
Closing: the consensus above was to keep the explicit (char *)NULL sentinels.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Rejected"
- status changed to: "Closed"