Re:Show HN: Buckaroo – A decentralized C++ package manager
by jackewiehose on Friday February 01, 2019 @05:54PM
(#19059583)
I think what we all want is a proper import-statement.
> as a new compilation unit ( https://en.wikipedia.org/wiki/Single_Compilation_Unit )
> Single Compilation Unit (SCU) is a computer programming technique [...] The technique can be applied to an entire program or to some subset of source files; when applied to an entire program, it is also known as a unity build.
Who came up with that? I would say this "technique" doesn't even justify having a wikipedia page. In modern c++ you can be glad if you have a c++ unit that doesn't need to recompile on change because of all the header-only stuff. No one would include .cpp-files by choice.
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?
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.
#include source "path.c"; compiles and includes path.c as a new compilation unit ( https://en.wikipedia.org/wiki/Single_Compilation_Unit ) .
So if a-file.c and b-file.c are both have
then these two files can be successfully included as But this: will produce the error "foo is already defined"This small feature will allow 99% of existing libraries to be included this way - without any makefile, GUP, GIP and the rest of the zoo.
Now I can put in Microsoft VC++ this
to include the library into final binary.#include source is just a generalization of the idea.