Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>It is clear that the <code>thread_proxy</code> function is private internal and I do not expect that it would be mangled as "thread_proxy" because I actually do not need it mangled at all.</p> </blockquote> <p>Regardless, it's still going to be mangled. (Had it not been <code>extern "C"</code>) That's just how the compiler works. I agree it's conceivable a compiler could say "this doesn't necessarily need to be mangled", but the standard says nothing on it. That said, mangling doesn't come into play here, as we aren't trying to link to the function.</p> <blockquote> <p>In fact, in all my code that I had written and that runs on many platforms, I never used <code>extern "C"</code> and this had worked as-is with normal functions.</p> </blockquote> <p>Writing on different platforms has nothing to do with <code>extern "C"</code>. I expect all standard C++ code to work on all platforms that have a standard C++ compliant compiler.</p> <p><code>extern "C"</code> has to do with interfacing with C, which pthread is a library of. Not only does it not mangle the name, it makes sure it's callable with the C calling convention. It's the calling convention that needs to be guaranteed, and because we can't assume we are running on a certain compiler, platform, or architecture, the best way to try and do that is with the functionality given to us: <code>extern "C"</code>.</p> <blockquote> <p>My problem is that <code>extern "C"</code> functions pollute the global namespace and they are not actually hidden as the author expects.</p> </blockquote> <p>There's nothing polluting about the above code. It's in an unnamed namespace, and not accessible outside the translation unit.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload