News for hackers. Stuff that matters.
Re:The memory models that underlie programming languages (2016) by scoutt on Friday June 11, 2021 @05:51AM (#27471197)
> No, buf is not exported, so it's "static" in C terminology.

Yes, I know that is not exported. What I wanted to say is that in the C example, no one outside tmpstr(void) can access static char buf[16][1024].

In the Rust example I can access static ref BUF from fn main() function, for example.

Re:The memory models that underlie programming languages (2016) by littlestymaar on Friday June 11, 2021 @07:55AM (#27472087)
> In the Rust example I can access static ref BUF from fn main() function, for example.

Only because in that simple example, BUF was defined directly in the main module.

In a more realistic exemple, BUF and tmpstr would belong to their own module, with only tmpstr being exported (and then accessible). See: https://play.rust-lang.org/?version=stable&mode=debug&editio...