Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!att!dptg!ulysses!andante!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: comp.lang.c++ Subject: Re: internal linkage for member functions? Message-ID: <10628@alice.UUCP> Date: 26 Mar 90 16:04:43 GMT References: <14373@cit-vax.Caltech.Edu> Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 35 In article , pcg@rupert.cs.aber.ac.uk (Piercarlo Grandi) writes: > 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. Indeed. But the second `m' you have defined here has nothing to do with the first. In fact, if you try compiling the example above, you will find that cfront says error: ``this'' used in non class context On the other hand, if you make it plain that the second `m' is an attempt to define the first: struct c { int i; int m(int = 0); }; static int c::m (auto int j) { return this->i*j; } you will find that indeed you cannot say `static' for a member function: error: static specified for qualified name m() -- --Andrew Koenig ark@europa.att.com