Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!ukc!dcl-cs!aber-cs!rupert!pcg From: pcg@rupert.cs.aber.ac.uk (Piercarlo Grandi) Newsgroups: comp.lang.c++ Subject: Re: internal linkage for member functions? Message-ID: Date: 25 Mar 90 21:49:38 GMT References: <14373@cit-vax.Caltech.Edu> Sender: pcg@aber-cs.UUCP Organization: Coleg Prifysgol Cymru Lines: 33 In-reply-to: ronen@cit-vax.Caltech.Edu's message of 22 Mar 90 02:07:59 GMT Posting-Front-End: GNU Emacs 18.47.1 of Wed Mar 15 1989 on rupert (berkeley-unix) In article <14373@cit-vax.Caltech.Edu> ronen@cit-vax.Caltech.Edu (Ronen Barzel) writes: C++ does not seem to allow "internal linkage" for member functions. Uh uh. Another guy that does not consistently follow my advice. Sorry, you are going to receive soon a call from who-you-know... :-) Given my all important and previous advice (:->) that member functions be *always* defined _after_ the class definition (in which only member functions declarations should appear), and that the storage class be *always* explicit in C++, you can write for example: struct c { int i; int m(int = 0); }; to *declare* 'm' and static int m (auto int j) { return this->i*j; } to *define* it with stoarage class static, that is internal linkage. The C++ compiler must not assume that the declaration of a member function implies external linkage, because there is no way to specify it in a member function declaration. Of course, if C++ did away entirely with the useless and confusing notion of member functions, or at least did not allow them to be declared inside the class definition, many problems like this would be immensely clarified or disappear altogether. -- Piercarlo "Peter" Grandi | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk Dept of CS, UCW Aberystwyth | UUCP: ...!mcvax!ukc!aber-cs!pcg Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk