|
-
May 1st, 2009, 01:43 AM
#1
Internal linkage in .cpp files: why bother?
Hi,
I'm still grappling with the concepts of linkage and memory management. I'm from a Java/C# background, so I'm used to static classes, and I'm trying to make the transition to namespaces where appropriate.
So I was reading up on the use of "private/helper" functions for namespaces being defined within an anonymous namespace to force internal linkage.
My question is this: what's the point of forcing internal as opposed to external linkage if these functions are defined in a .cpp file? Clients of the namespace will be including the header file, so anything of global scope declared/defined in the .cpp shouldn't be visible anyhow, right? Why bother with the anonymous namespace trick at all, in this case?
Last edited by cmc5788; May 1st, 2009 at 01:46 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|