On Wednesday, 19 July 2017 at 15:28:50 UTC, Steven Schveighoffer
wrote:
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.
That's correct. We unfortunately can't do certain optimizations
because of this (executable size related: removing unused or
inlined only functions, ...).
The reason we can't make private functions object local are
templates. A public template can access private functions, but
the template instance may be emitted to another object. And as
templates can't be checzked speculatively we don't even know if
there's a template accessing a private function.
Dlls on Windows face a similar problem. Once we get the export
templates proposed in earlier Dll discussions we can make
non-exported, private functions object local.