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

obsolete: 8.4.2
closed-fixed
3
2003-05-13
2003-05-05
Paul E Johnson
No

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 int Tcl_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

Discussion

  • miguel sofer
    miguel sofer
    2003-05-12

    • labels: 104254 --> 49. Threading
     
  • miguel sofer
    miguel sofer
    2003-05-12

    • assigned_to: msofer --> mistachkin
     
  • Joe Mistachkin
    Joe Mistachkin
    2003-05-13

    • priority: 5 --> 3
     
  • Joe Mistachkin
    Joe Mistachkin
    2003-05-13

    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?

     
  • Paul E Johnson
    Paul E Johnson
    2003-05-13

    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.

     
  • Pat Thoyts
    Pat Thoyts
    2003-05-13

    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).

     
  • Joe Mistachkin
    Joe Mistachkin
    2003-05-13

    • status: open --> closed-fixed