Re: extern(C) on var decl is confusing

2025-07-28 Thread user1234 via Digitalmars-d-learn
On Monday, 28 July 2025 at 11:06:40 UTC, kinke wrote: On Sunday, 27 July 2025 at 23:23:40 UTC, user1234 wrote: That is confusing It affects the mangling of global vars, just like functions. ah indeed

Re: extern(C) on var decl is confusing

2025-07-28 Thread kinke via Digitalmars-d-learn
On Sunday, 27 July 2025 at 23:23:40 UTC, user1234 wrote: That is confusing It affects the mangling of global vars, just like functions.

Re: extern(C) on var decl is confusing

2025-07-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, July 27, 2025 5:23:40 PM Mountain Daylight Time user1234 via Digitalmars-d-learn wrote: > That is confusing, e.g > > ``` > extern(C) int r; > > int main() > { > return r; > } > ``` > > works. But what is likely more intended here is > > ``` > extern int r; > > int main() > { >

extern(C) on var decl is confusing

2025-07-27 Thread user1234 via Digitalmars-d-learn
That is confusing, e.g ``` extern(C) int r; int main() { return r; } ``` works. But what is likely more intended here is ``` extern int r; int main() { return r; } ``` which leads, this time, to the expected linker error.