Overview
| Artifact ID: | 5736ad6a79c8fb3ea138fdde3e719f5f4955f263 |
|---|---|
| Ticket: | 509340ffffffffffffffffffffffffffffffffff
ClientData set to int* not void* |
| User & Date: | nobody on 2002-05-28 19:39:22 |
Changes
- icomment:
Logged In: NO Currently ClientData is defined as follows (from tcl.h) # if defined(__STDC__) || defined(__cplusplus) typedef void *ClientData; # else typedef int *ClientData; # endif /* __STDC__ */ With the Borland compiler (and apparently with VC++, too) this will result in" typedef int *ClientData", leading to a lot of otherwise unnecessary typecasts. Explanation: For the Borland compiler __STDC__ means *strict* compliance to ANSI C (you can set this mode with the -A flag). With this flag turned on, however, Tcl won't compile - some Windows header files containing C++ style (//) comments. I tend to think that this is a sensible thing to do (you want ANSI C, you get - strict - ANSI C), but this is just opinion - we got a problem to solve. The criterion used above # if defined(__STDC__) || defined(__cplusplus) assumes this scenario: - pre-ANSI C - ANSI C or - C++ However this does not describe the actual situation, where we have sort of a post-ANSI period: C compilers adhering to the standard but allowing extensions, too (like C++ comments). (And differing of course in whether they #define __STDC__ for these extensions or not.). I would therefore suggest that we change the criterion. After all, all we want to know is whether the compiler knows the 'void' key word. We don't really care (at this point) whether its internal logic defines __STDC__. So my suggestion is to add a #define KNOSW_VOID and use this for the typedef of ClientData # ifdef KNOWS_VOID typedef void *ClientData; # else typedef int *ClientData; # endif /* KNOWS_VOID */ I assume that all current compilers support 'void', so we probably don't even need this check. If, however, it turns out that there is a compiler which barks on 'void', we could add stuff to handle just this compiler. #define KNOWS_VOID #if defined SomeWeirdCompiler #undef KNOWS_VOID #endif In any case, we should change the criterion in some way, because it doesn't handle the actual situation. Just my 0.02 Helmut Giese - login: "nobody"
- mimetype: "text/plain"
- username: "nobody"