Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2002-08-05
10:28 • Closed ticket [580433ffff]: CONST prototypes in 8.4. plus 8 other changes artifact: a0e43baefb user: dgp
2002-07-24
10:51 • Ticket [580433ffff]: 4 changes artifact: a05cebdc59 user: dgp
2002-07-16
08:06 • Add attachment tkconst.patch to ticket [580433ffff] artifact: 1f7f23e682 user: dgp
08:06 • Ticket [580433ffff] CONST prototypes in 8.4. status still Open with 4 other ... artifact: 51955271b4 user: dgp
06:42 • Ticket [580433ffff]: 4 changes artifact: cbb8bca602 user: dgp
06:41 • Ticket [580433ffff]: 4 changes artifact: c1ea92758a user: dgp
06:41 • Add attachment const.patch to ticket [580433ffff] artifact: f5836f9782 user: dgp
2002-07-13
02:30 • Ticket [580433ffff] CONST prototypes in 8.4. status still Open with 4 other ... artifact: 81128bd7d9 user: ghowlett
02:15 • Ticket [580433ffff]: 4 changes artifact: e9e4952dc9 user: dgp
01:30 • Open ticket [580433ffff]. artifact: 4c398f7f50 user: ghowlett
01:18 • Pending ticket [580433ffff]. artifact: c1572f2584 user: dgp
00:08 • Ticket [580433ffff]: 1 change artifact: 6c00050ddb user: hobbs
2002-07-12
05:55 • New ticket [580433ffff]. artifact: 9e1905d54e user: ghowlett

CONST prototypes in 8.4.

Closed / Fixed580433ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2002-07-12 05:55:35
There are several prototypes that formerly in 8.3 returned 
char * values.  One example is Tcl_SetVar2.  

They now return CONST char * values.   This should be 
CONST84 char * so that extension writers can define
USE_NON_CONST.  

--gah
hobbs Ticket [580433ffff]: 1 change [History diff]2002-07-13 00:08:31
dgpplain2002-07-13 01:18:21
Logged In: YES 
user_id=80530


The CONST84 macro is tied only to those
changes that cannot be reconciled.  The
return of a CONST char * where a char *
was returned before can be reconciled by
adding "const" in the caller, so that the
modified code compiles with both 8.3
and 8.4 headers.

This type of source incompatibility
was approved in TIP 27.
ghowlettplain2002-07-13 01:30:44
Logged In: YES 
user_id=137748

Adding const in the caller's code cacades changes
throughout. Either one
wants to use const everywhere or they don't.  There's no
middle ground.

This is a nuisance for everyone trying to port old code to
8.4.  What's
the issue for not using CONST84 instead?  

--gah
dgpplain2002-07-13 02:15:42
Logged In: YES 
user_id=80530


That's just not what USE_NON_CONST / CONST84 is for.

CONST84 exists to disable only those new CONSTs that
would otherwise force extensions to drop (compiling) 
support for pre-8.4 Tcl, because compilers do not know
how to convert a (char **) to a (const char **).
USE_NON_CONST allows for support for both 8.3
and 8.4 headers until a package naturally wants to
require 8.4 because it is using 8.4 features.

Tcl routines that now return (CONST char *) where
they previously returned (char *) do not need such a
mechanism, because compilers do know how to
convert (char *) values into (const char *) values.
This means that extensions can update their code
to compile with both 8.3 and 8.4 headers, and
that's what they're expected to do to begin
supporting Tcl 8.4.

Tcl 8.4 does not offer a "#define and go" migration
option for dealing with the CONST-ification changes.
At a minimum, extensions must deal with the source
incompatibility approved by TIP 27.

It's possible that such a "#define and go" option could be
provided, but it would need to be something new, not a
dual meaning imposed on CONST84.  I'd rather not
go that way, but it is possible.
ghowlettplain2002-07-13 02:30:22
Logged In: YES 
user_id=137748

Unfortunately it's counterproductive. 
It causes extensions to drop support of 8.4 (or more 
accurately, people won't take the time to make them
compile with 8.4).  It's too bad that source code 
compatibility isn't as valued as binary compatibilty.  
That's what CONST84 is supposed to prevent.

--gah
dgpplain2002-07-16 06:41:59
Logged In: YES 
user_id=80530


Here's a patch that addresses the issue.

Apply the patch, `make genstubs`, and install.
The resulting headers will be configurable 
like so:

#define USE_NON_CONST

will disable all new CONSTs that cause any
kind of source incompatibility with Tcl 8.3.
This is the "#define & go" option.

#define USE_COMPAT_CONST

this does what USE_NON_CONST
used to do -- disables only those new
CONSTs that would otherwise force
one to support only 8.4 and up.

With neither of those defined, the
header will supply the documented
Tcl 8.4 interfaces.

The patch also CONSTifies a few more
APIs -- notably the Tcl_CmdProc typedef.
Now that USE_NON_CONST offers a way
to completely avoid the changes, there's no
reason to delay the really tough one.

Note that Tk, like other extensions,
will need modifications to use the
features of this patch.

Please try and comment.
dgpplain2002-07-16 06:42:00
File Added - 27089: const.patch
dgpplain2002-07-16 08:06:01
File Added - 27096: tkconst.patch

Logged In: YES 
user_id=80530


Here is a companion patch for Tk.
dgpplain2002-07-24 10:51:38
Logged In: YES 
user_id=80530

see also Patch 585105.
dgpplain2002-08-05 10:28:33
Logged In: YES 
user_id=80530

fixed by acceptance of Patch 585105.
Log in (anonymous is fine) to add a comment.

Attachments: