Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site watdaisy.UUCP Path: utzoo!watmath!watdaisy!ndiamond From: ndiamond@watdaisy.UUCP (Norman Diamond) Newsgroups: net.lang.c Subject: external names that aren't valid C identifiers Message-ID: <6969@watdaisy.UUCP> Date: Fri, 15-Feb-85 17:03:33 EST Article-I.D.: watdaisy.6969 Posted: Fri Feb 15 17:03:33 1985 Date-Received: Sat, 16-Feb-85 05:51:18 EST Distribution: net Organization: U of Waterloo, Ontario Lines: 41 Here is a suggestion that is only moderately ugly, but unambiguous and won't break any programs. (1) To refer to an external name (data or function) whose name isn't a valid C identifier: extern "external$name" [maybe a type] c_identifier [maybe ()] (The external name is in a quoted string. The brackets are meta-syntax to indicate optional tokens.) For that matter, the external name could also be a valid c identifier, but old or ported code still wants to use the old name. Anyway, the external name would not be available to the source code; it would have to use the C identifier. However, the compiler would generate object code using the external name. (2) To define some data or a function with an external name that isn't a valid C identifer: "external$name" [maybe a type] c_identifer [maybe () or initializer, etc.] Same criteria as for the first suggestion. This one's a little harder on a parser, because the string might look like the beginning of an expression instead of a declaration. However, it really isn't ambiguous, and it is surrounded by semicolons (unless it's the first declaration). The second suggestion is only of interest to anyone who wants C stuff to be callable from other languages. Admitted, fewer C programmers would accept this kind of requirement, than for their own need to issue system calls and such stuff in non-unix environments :-) . -- Norman Diamond UUCP: {decvax|utzoo|ihnp4|allegra|clyde}!watmath!watdaisy!ndiamond CSNET: ndiamond%watdaisy@waterloo.csnet ARPA: ndiamond%watdaisy%waterloo.csnet@csnet-relay.arpa "Opinions are those of the keyboard, and do not reflect on me or higher-ups."