Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2002-09-09
23:31 • Closed ticket [601285ffff]: make USE_COMPAT_CONST the default plus 6 other c... artifact: b1c92e35eb user: dgp
2002-08-28
22:32 • Ticket [601285ffff]: 4 changes artifact: 6168f5e8ee user: drh
21:38 • Ticket [601285ffff]: 5 changes artifact: d8398ad687 user: dgp
20:54 • Ticket [601285ffff]: 4 changes artifact: 6b1fd195ec user: drh
20:32 • Ticket [601285ffff]: 4 changes artifact: cf465bd3e8 user: dgp
13:14 • New ticket [601285ffff]. artifact: 5a56f6b799 user: drh

make USE_COMPAT_CONST the default

Closed601285ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2002-08-28 13:14:07
The 2002-08-04 patch to TCL has broken backwards
compatibility of the C/C++ API.  Legacy code will
no longer compile without (sometimes major) changes.
This may be appropriate for Tcl 9.0, but for
Tcl 8.4 I think we should preserve backwards
compatibility.

I recommend turning on the USE_COMPAT_CONST mode
by default in the 8.x series and having a 
different #define that can enable the new
CONST-ifying where desired. When 9.x comes out,
then we can go to having incompatible CONST
definitions in the API.

The specific problem I am having is with the
Tcl_CreateCommand() interface, which now requires
a "const char**" on the Tcl_CmdProc instead of a
"char**".

Furthermore, just doing:

   #define USE_COMPAT_CONST 1
   #include <tcl.h>

does not solve the problem, since after doing so
I am getting complaints about trying to pass a
"const char**" in as the 3 argument to
Tcl_GetIndexFromObj().
dgpplain2002-08-28 20:32:32
Logged In: YES 
user_id=80530


I believe the availabilty of USE_NON_CONST offers
complete support for full backward source
compatibility.  This was done to fix Bug 580433.

See also http://mini.net/tcl/3669

In the terminology of that Wiki page, both the
Tcl_CmdProc change and the Tcl_GetIndexFromObj
change are of "Type III", so both should be disabled
by a #define of USE_COMPAT_CONST.

Is the troublesome code available for examination, or
can you supply a demonstration of the trouble you
are seeing?
drhplain2002-08-28 20:54:37
Logged In: YES 
user_id=69293

My point is that there should not be ANY changes
required to legacy code in order to link against
Tcl8.4.  Even simple changes like defining
USE_COMPAT_CONST before including tcl.h.  Otherwise
you break backwards compatibility, and traditionally
that requires a change to the major version number.
dgpplain2002-08-28 21:38:11
Logged In: YES 
user_id=80530


Tcl/Tk has a history of exactly this kind of source
incompatibility at a minor release, with exactly
this sort of #define support for old source code.  See

USE_OLD_IMAGE
USE_OLD_TAG_SEARCH
USE_OLD_CANVAS
USE_COMPOSITELESS_PHOTO_PUT_BLOCK

USE_NON_CONST fits right in.

That said, let's boil this down to the actual
feature request.  The HEAD tcl.h currently
offers three options:

USE_NON_CONST: disable Types II and III
USE_COMPAT_CONST: disable Type III only
<no #define>: fully CONSTified interface

The 8.4 default is the fully CONSTified option,
and your request is that the default should be
the current USE_COMPAT_CONST option
instead?
drhplain2002-08-28 22:32:56
Logged In: YES 
user_id=69293

I think this is an important issue that needs to
be discussed (and perhaps voted on) by the whole
team. I'll make a posting to the mailing list...
dgpplain2002-09-09 23:31:11
Logged In: YES 
user_id=80530

Closing this as resolved by mailing list discussion.
Log in (anonymous is fine) to add a comment.