|
2003-11-25
| ||
| 21:08 | • Ticket [845155ffff] Check ANSI C switches status still Closed with 4 other c... artifact: 2029cea179 user: elfring | |
|
2003-11-20
| ||
| 01:53 | • Closed ticket [845155ffff]. artifact: 84841dd728 user: dkf | |
| 01:41 | • Open ticket [845155ffff]. artifact: 8a466a0555 user: elfring | |
| 01:10 | • Ticket [845155ffff]: 4 changes artifact: ae99ebea53 user: hobbs | |
| 00:59 | • Ticket [845155ffff]: 4 changes artifact: 8c677ac0dd user: elfring | |
|
2003-11-19
| ||
| 22:03 | • Closed ticket [845155ffff]. artifact: 7eb019a325 user: dkf | |
| 14:32 | • New ticket [845155ffff]. artifact: fc547480b4 user: elfring | |
Check ANSI C switches
Closed / Rejected845155ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2003-11-19 14:32:40
I see that the macro "_ANSI_ARGS_" is used for definitions of function pointers. (File "generic/tcl.h")
But I am missing a macro to switch between old style function signature and current ANSI conformance.
File "generic/tclAlloc.c":
...
char *
TclpAlloc(nbytes)
unsigned int nbytes;/* Number of bytes to allocate. */
{ ...
I would prefer this definition.
...
void* TclpAlloc(unsigned int nbytes /* Number of bytes to allocate. */)
{ ...
#if defined(__STDC__) || defined(__cplusplus)
# undef NO_PROTOTYPES
# define FUNCTION_PARMETER_DELIMITER ,
# define FUNCTION_HEAD(specifiers, name, parameters) specifiers name (parameters)
#else
# define FUNCTION_PARMETER_DELIMITER ;
# define FUNCTION_HEAD(specifiers, name, parameters) specifiers name () parameters
#endif
#define FUNCTION_PARMETER_JOIN(x, y) x##FUNCTION_PARMETER_DELIMITER y##FUNCTION_PARMETER_DELIMITER
=> Example:
FUNCTION_HEAD(EXTERN void*, TclpRealloc, FUNCTION_PARMETER_JOIN(char *cp, unsigned int nbytes))
dkfplain2003-11-19 22:03:26
Logged In: YES user_id=79902 Yuck. No. That's a horrible suggestion.
elfringplain2003-11-20 00:59:46
Logged In: YES user_id=572001 FUNCTION_HEAD(EXTERN VOID *, TclpRealloc, FUNCTION_PARMETER_JOIN(VOID * cp, SIZE_T nbytes)) Why do you think that this is horrible? Do you not want to achieve standard conformant function defintions by special macros?
hobbsplain2003-11-20 01:10:29
Logged In: YES user_id=72656 That really reduces the readability of the function headers. I think the better solution is to rewrite all the function headers in the ANSI conformant style. I don't think the old style is necessary anymore, and I vaguely recall that some compilers will actually have better type checking when true ANSI conformant headers are used.
elfringplain2003-11-20 01:41:11
Logged In: YES user_id=572001 I agree, too. But I do not know if my voice counts in such a fundamental decision. I assumed that you want that TCL can be still compiled with non compliant tools.
dkfplain2003-11-20 01:53:39
Logged In: YES user_id=79902 In any case, your macro stuff is awful and would massively worsen the code quality of the core. And its wrong and inflexible too. This FRQ is Rejected and Closed. If you wish to discuss converting the core to use ANSI C function definition headers, do so via email on the tcl-core mailing list.
elfringplain2003-11-25 21:08:50
Logged In: YES user_id=572001 The discussion is running... http://sourceforge.net/mailarchive/forum.php? thread_id=3520178&forum_id=3854
Log in (anonymous is fine) to add a comment.