Re:Show HN: Buckaroo – A decentralized C++ package manager
by fwip on Friday February 01, 2019 @05:07PM
(#19059212)
And if b-file.c says "static int foo = 43;" what is the desired behavior?
[ Parent
| on HN ]
Re:Show HN: Buckaroo – A decentralized C++ package manager
by c-smile on Friday February 01, 2019 @05:28PM
(#19059381)
In C/C++ static declarations are local to the compilation unit. So you will have two separate storages for foo - these will be two independent variables.
That's how C and C++ work.
And if you will have this (no static):
int foo = 45;
then linker will complain - "multiple 'foo' entities" as non-static entities have global visibility.
Re:Show HN: Buckaroo – A decentralized C++ package manager
by ghthor on Friday February 01, 2019 @05:14PM
(#19059269)
I'd imagine a compiler error that static values, aka globals, must not differ at compile time. This would likely apply to consts as well.