Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Please do not use "id" as a dummy variable in functions

Closed / Fixed732477ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2003-05-05 04:08:08
In the upgrade from tcl/tk 8.3 to 8.4, I started to
encounter trouble compiling programs in Objective-C
that are linked with tcl/tk.  We can't compile the
Swarm library (www.swarm.org) against 8.4 because "id"
is used as a variable name.  The problem is that
Objective-C uses a reserved word "id" to refer to an
object.  

The problems are in tclDecls.h

EXTERN intTcl_JoinThread _ANSI_ARGS_((Tcl_ThreadId
id,  int* result));

I notice in some of your other functions you have
threadId where this one has "id".

As it stands, in order to compile Swarm, I have to
comment out Tcl_JoinThread from tclDecls.h
msofer Ticket [732477ffff]: 1 change [History diff]2003-05-13 01:00:30
msofer Ticket [732477ffff]: 1 change [History diff]2003-05-13 01:00:31
mistachkinplain2003-05-13 09:14:06
Logged In: YES 
user_id=113501

According to the ANSI standard, compilers are not 
supposed to reserve identifiers that do NOT start with 
an underscore or double underscore.

Does anybody know if we support compilation using 
Objective-C?
pauljohn32plain2003-05-13 12:06:23
Logged In: YES 
user_id=23726

Hello.  My understanding has been that in C one cannot have
dummy variables named "int", "double", "float", etc.  It
won't allow a function like

int aFunct (int double);

or some such thing, right?

In Objective-C, "id' is like "double".  The problem would go
away if you just changed "id" to "threadID" in that one method.
patthoytsplain2003-05-13 16:19:05
Logged In: YES 
user_id=202636

Bear in mind that this only requires changing in the public
header. In fact you could simply delete the word 'id' and
leave the bare signature. One wouldn't compile tcl itself
with objective-c but should be able to create extensions
using this compiler. 

It certainly used to work (some time ago).
mistachkin Closed ticket [732477ffff]. [History diff]2003-05-13 16:58:13
mistachkin Ticket [732477ffff]: 2 changes [History diff]2003-05-13 17:25:53
mistachkin Ticket [732477ffff]: 2 changes [History diff]2003-05-13 17:27:49
Log in (anonymous is fine) to add a comment.