C style 'static' functions
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jul 19 08:28:50 PDT 2017
On 7/19/17 8:16 AM, Petar Kirov [ZombineDev] wrote:
> On Wednesday, 19 July 2017 at 12:11:38 UTC, John Burton wrote:
>> On Wednesday, 19 July 2017 at 12:05:09 UTC, Kagamin wrote:
>>> Try a newer compiler, this was fixed recently.
>>
>> Hmm it turns out this machine has 2.0.65 on which is fairly ancient.
>> I'd not realized this machine had not been updated.
>>
>> Sorry for wasting everyones' time if that's so, and thanks for the help.
>
> Just for the record, private is the analog of C's static. All private
> free and member functions are callable only from the module they are
> defined in. This is in contrast with C++, Java, C# where private members
> are visible only the class they are defined in.
I'm not so sure of that. Private functions still generate symbols. I
think in C, there is no symbol (at least in the object file) for static
functions or variables.
You could still call a private function in a D module via the mangled
name I believe.
-Steve
Note: not 100% sure of all this, but this is always the way I've looked
at it.
More information about the Digitalmars-d-learn
mailing list