Skip to content
Tcl Source Code Artifact [b2d471c299]
Login

Artifact [b2d471c299]

Artifact b2d471c299cc01182d9e50fb2624a89e61e3aa40:

Ticket change [b2d471c299] - New ticket [565088ffffffffff|565088ffff] <i>Bring tcl.h into the 1990s</i>. by jenglish on 2002-06-05 23:33:17.
D 2002-06-05T23:33:17
J assignee jenglish
J cmimetype text/plain
J comment Brief\ssummary:\s<tcl.h>\scontains\sseveral\spreprocessor\nmacros\sintended\sto\said\ssource-level\scompatibility\nbetween\sANSI\sC\sand\sK&R\sC\scompilers.\s\sHowever,\sthe\n#ifdef\slogic\stends\sto\sassume\sK&R\sC\sby\sdefault\sand\nenables\smodern\sfeatures\sbased\son\sthe\spresence\sof\n__STDC__\sand/or\sother\sspecial\scases.\n\nSince\spre-ANSI\scompilers\sare\sa\srarity\snowadays\s(2002),\nand\smany\scompilers\sdo\snot\sdefine\s__STDC__\sin\sthe\ndefault\s(non-strict-ansi)\smode\seven\sthough\sthey\sdo\sin\nfact\ssupport\sall\sthe\srelevant\sfeatures,\sit\swould\smake\nmore\ssense\sto\sassume\smodern\sC\sby\sdefault\sand\sonly\nenable\sthe\sbackwards-compatibility\smacros\son\sa\nspecial-case\sbasis.\n\nI'll\sput\stogether\sa\spatch\sin\sthe\snext\scouple\sof\sdays.\n\nDetailed\sanalysis\s(from\sa\spost\sto\scomp.lang.tcl):\n\nFrom:\[email protected]\s(Joe\sEnglish)\nNewsgroups:\scomp.lang.tcl\nSubject:\sRe:\sBuild\sproblem\susing\saCC\son\sHP-UX\nDate:\s5\sJun\s2002\s15:32:02\sGMT\nMessage-ID:\s<[email protected]>\n\n[...]\nThe\sTcl\score\swas\sC89-compatible\suntil\sthe\srecent\n(8.4a2?\s3?)\naddition\sof\s"long\slong",\swhich\sis\sa\sC99\sfeature.\s\n(Actually,\nI'm\snot\ssure\sunder\swhich\sconditions\s'long\slong'\sis\nactually\nused\s--\sit's\stough\sto\sdecipher\swhat's\sgoing\son\sin\sthe\n#ifdef\nchain\sin\stcl.h).\n\nHowever,\sthe\score\salso\sincludes\sbackwards-compatibility\n#defines\sfor\sseveral\sfeatures\swhich\swere\snot\spresent\sin\nK&R\sC\s(VOID,\sCONST,\sUSE_PROTOTYPE,\sUSE_STDARG,\setc.).\nThe\schoice\sof\swhether\sto\suse\sC89\sor\sK&R\sfeatures\sis\ndetermined\sby\swhether\sor\snot\s__STDC__\sis\s#define'd,\nor,\sin\smany\scases,\swith\san\sadditional\slist\sof\sspecial\ncases,\se.g.\n\n\s\s\s\s#\s\s\sif\sdefined(__STDC__)\s||\sdefined(__cplusplus)\s||\ndefined(__BORLANDC__)\n\nMost\scompilers\snowadays\s(in\smy\sexperience)\sare\sC89,\sbut\ndo\snot\syet\sfully\ssupport\sC99.\s\sMany\sof\sthese\ssupport\nC9X\sfeatures\slike\s"long\slong",\sbut\sonly\swhen\sinvoked\sin\n"extensions-enabled"\smode.\n\nHere's\swhere\sthe\sproblem\scomes\sup:\s"long\slong"\sis\nstandard\sC99,\nbut\sit's\san\sextension\sto\sC89;\sthus\s20th\scentury\ncompilers\sdon't\nenable\sit\sin\s"strict\sANSI"\smode\sand\sTcl\s8.4\scan't\sbe\ncompiled\nin\sthat\smode.\s\sMost\scompilers\s--\sGCC\sbeing\sa\snotable\nexception\s--\ndon't\sdefine\s__STDC__\swhen\sextensions\sare\senabled,\sso\nall\sof\nthe\sbackwards-compatibility\scruft\sin\stcl.h\sgets\nactivated\n(except\son\splatforms\swhich\shave\sbeen\saccounted\sfor\sby\sa\nspecial-case\spreprocessor\stest\sas\sabove).\n\nThe\scorrect\sway\sto\sproceed\sis\sIMO\sto\sbring\stcl.h\sinto\nthe\s1990s:\nit\sshould\sassume\sC89\sfeatures\sare\spresent\sby\sdefault\n(void,\sconst,\nstdarg.h,\setc.),\sand\sonly\senable\sthe\nbackwards-compatibility\ncruft\son\sa\sspecial-case\sbasis,\sinstead\sof\sthe\sother\sway\naround.\nFor\sexample,\sinstead\sof:\n\n\s\s\s\s#if\s((defined(__STDC__)\s||\sdefined(SABER))\s&&\n!defined(NO_PROTOTYPE))\s\\\n\s\s\s\s\s\s\s\s||\sdefined(__cplusplus)\s||\ndefined(USE_PROTOTYPE)\n\s\s\s\s#\s\s\sdefine\s_USING_PROTOTYPES_\s1\n\s\s\s\s#\s\s\sdefine\s_ANSI_ARGS_(x)\s\s\sx\n\s\s\s\s#\s\s\sdefine\sCONST\sconst\n\s\s\s\s#else\n\s\s\s\s#\s\s\sdefine\s_ANSI_ARGS_(x)\s\s\s()\n\s\s\s\s#\s\s\sdefine\sCONST\n\s\s\s\s#endif\n\nuse\ssomething\slike:\n\n\s\s\s\s\s\s\s\s#if\sdefined(ANCIENT_COMPILER)\n\s\s\s\s\s\s\s\s#\s\s\s\s\s\s\sdefine\sCONST\n\s\s\s\s\s\s\s\s#\s\s\s\s\s\s\sdefine\s_ANSI_ARGS_(x)\n\s\s\s\s\s\s\s\s#else\n\s\s\s\s\s\s\s\s#\s\s\s\s\s\s\sdefine\s_ANSI_ARGS_(x)\sx\n\s\s\s\s\s\s\s\s#\s\s\s\s\s\s\sdefine\sCONST\sconst\n\s\s\s\s\s\s\s\s#endif\n\nwhere\sANCIENT_COMPILER\sis\sundefined\sby\sdefault.\n
J foundin None
J priority 3\sLow
J resolution None
J status Open
J submitter jenglish
J subsystem 52.\sPortability\sSupport
J title Bring\stcl.h\sinto\sthe\s1990s
J type RFE
K 565088ffffffffffffffffffffffffffffffffff
U jenglish
Z 524326eb9f1333898efa1225063b95fd