From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10a146,a03ae7f4e53958e1 X-Google-Attributes: gid10a146,public X-Google-Thread: fac41,a03ae7f4e53958e1 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,8775b19e3c68a5dc X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,a03ae7f4e53958e1 X-Google-Attributes: gid1014db,public X-Google-Thread: 109fba,a03ae7f4e53958e1 X-Google-Attributes: gid109fba,public X-Google-Thread: fa0ae,a03ae7f4e53958e1 X-Google-Attributes: gidfa0ae,public X-Google-Thread: 1094ba,a03ae7f4e53958e1 X-Google-Attributes: gid1094ba,public X-Google-Thread: 114809,a03ae7f4e53958e1 X-Google-Attributes: gid114809,public From: bill@cafe.net (Kaz Kylheku) Subject: Re: Which language pays most 17457 -- C++ vs. Java? Date: 1997/12/24 Message-ID: <67rjb3$pfb$1@brie.direct.ca>#1/1 X-Deja-AN: 309955022 References: <199712121931.LAA25389@sirius.infonex.com> <67iipp$ktj$1@darla.visi.com> <882756127snz@genesis.demon.co.uk> <34A14C27.57C0@min.net> Organization: Internet Direct Reply-To: kaz@cafe.net Newsgroups: comp.lang.fortran,comp.lang.c,comp.lang.c++,comp.lang.eiffel,comp.lang.java.programmer,comp.lang.smalltalk,comp.lang.perl.misc,comp.lang.ada,comp.edu Date: 1997-12-24T00:00:00+00:00 List-Id: In article <34A14C27.57C0@min.net>, John Porter wrote: >Lawrence Kirby wrote: >> >> Aren't the standard library identifiers with external linkage reserved >> even in a freestandinhg environment? > >With the possible exception of environments for embedded development, >the identifiers defined in the standard or any other library are not >reserved words. If I don't include string.h, I am free to use the >id 'memcpy' for my own purposes. Even if I do link with a library which False. Although 'memcpy' is not a reserved keyword by any means, it is a reserved 'external name'. External names defined by the C library are reserved as external names regardless of what header you include. (An external name is an identifier with external linkage). Not only are those names reserved, but certain external name SPACES are reserved! A strictly conforming program may not define any external name that begins with 'mem' followed by any combination of letters, digits or underscores. This is true even though the library doesn't currently define anything else in that category other than 'memcpy' or 'memmove'. However, 'mem' itself is not reserved because it's not followed by any letters, digits or underscores. Similarly, identifiers beginning with 'to' and 'is' are reserved for future extensions to , and identifiers starting 'str' are reserved for future extensions to . I have set up my Vim 5.0 editor to colorize any occurence of an identifier that belongs to the forbidden name spaces. :) >defines memcpy, my definition overrides it. I'm not sure how you can >construe this to mean that 'memcpy' is in any way "reserved". You are sadly mistaken. In fact your overriding definition must have static linkage, otherwise your program invokes undefined behavior. Moreover, if you write such a static function, you must not include the header in the same translation unit, else undefined behavior results. There is no such thing as ``overriding'' in C. Each external name must have exactly one definition if it is used anywhere in the program. Additionally, an external name that is declared but never referenced, is permitted to be without an external definition. Overriding of library functions (via ``weak symbols'' or some other such resolution mechanism) is possible as a system-specific extension. How I can construe all this is by interpreting the fine words written in a document entitled _American National Standard for Programming Languages---C_, ANSI/ISO 9899:1990.