#Internal vs external vs other linkage
14 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
I expected a more understandable answer tbf. Cpp reference is kinda hard to understand for me. I know something about it but i didnt get it fully
• No linkage: "The name can be referred to only from the scope it is in."
• Internal linkage: "The name can be referred to from all scopes in the current translation unit." I.e. source file.
• External linkage: "The name can be referred to from the scopes in the other translation units."
!close
Thank you and let us know if you have any more questions!
This thread is now set to auto-hide after an hour of inactivity
Or, in other words, "no linkage" = can't be forward declared, "internal linkage" = can be forward-declared but only in this TU, "external linkage" = can be declared in other TUs too
Just to be sure, TU means a source file with included headers in it?
Yep
Simply a source file, inclusions are unrelated.
It's a source file after preprocessing, meaning after all includes got pasted into it
I'm simplifying it.
From c++20 onwards, module linkage is also a thing