Skip to content

Value declaring in threadbank.h #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
markkuleppala opened this issue Jan 30, 2020 · 0 comments
Open

Value declaring in threadbank.h #3

markkuleppala opened this issue Jan 30, 2020 · 0 comments

Comments

@markkuleppala
Copy link
Owner

Usually you want to declare a variable in only one place, preferably in a
code module. Then put an "extern" variable declaration in a header. That
way variable is allocated only once and connected together in linking stage.
If you have plain "int i;" in a header file, each source code module that
includes that header, will initialize a global variable with name i. This
can fail in compile time for multiple copies of symbol i.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant