Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-09-02
13:49 • Closed ticket [36ec49db6a]: Tcl_TraceVar manpage : missing `const` on char* fiel... artifact: 9f8b6cff5d user: jan.nijtmans
2022-09-01
15:40
Fix [36ec49db6abc3b1a]: Tcl_TraceVar manpage : missing `const` on char* fields check-in: 8d6764bee8 user: jan.nijtmans tags: core-8-6-branch
2022-08-31
23:43 • New ticket [36ec49db6a] Tcl_TraceVar manpage : missing `const` on char* fields</... artifact: 72332fc8e2 user: anonymous

Tcl_TraceVar manpage : missing `const` on char* fields

Closed / Fixed36ec49db6abc3b1a7f136c9fe3adaa02c183517fCreated 4 years agoUpdated 4 years ago
Descriptionplain2022-08-31 23:43:58
the manpage for Tcl_TraceVar describes Tcl_VarTraceProc as having the following
struct signature:

              typedef char *Tcl_VarTraceProc(
                      ClientData clientData,
                      Tcl_Interp *interp,
                      char *name1,
                      char *name2,
                      int flags);

But name1 and name2 should have the `const` qualifier according to tcl.h:

typedef char * (Tcl_VarTraceProc) (ClientData clientData, Tcl_Interp *interp,
  CONST84 char *part1, CONST84 char *part2, int flags);

I found this by accident trying to compile a little sample from Ousterhout's
book using Tcl_TraceVar in chapter 34, gcc complained about incompatible pointer
type (for the callback) until I added `const` to both args in the function
prototype for the callback supplied to Tcl_TraceVar.

So, just add the missing `const` to both char * fields in this manpage (and
others, if applicable).

I noticed that (my pdf version of) Ousterhout's book in several places uses
plain `char *` where `const char*` should be used, perhaps this is because at
some point there was a migration to enforce constness and documentation wasn't
fully updated to reflect the change (I'm just guessing here).
jan.nijtmanswiki2022-09-02 13:49:16

Fixed [here]

Thanks for the report!

Log in (anonymous is fine) to add a comment.