Boost C++ Libraries: Ticket #10697: Boost coroutine leaks windows.h into global namespace https://svn.boost.org/trac10/ticket/10697 <p> I was surprised that file "boost/coroutine/windows/protected_stack_allocator.hpp" from coroutine library from boost release 1.56.0 version just insanely includes windows.h in public header without any protection from the header leaking into global namespace severely polluting it. </p> <p> Because of this 'boost/coroutine/protected_stack_allocator.hpp' is rendered UNUSABLE/BROKEN on windows (all compilers) and namespace pollution may apply to <a class="missing wiki">Unix/Linux</a> as well. The feature is released very hacky and unfinished way by having such code issues. </p> <p> To fix this cleanly simplest thing would be to contain and move windows.h (or other platform depend) inclusion into a .cpp file which is compiled. </p> <p> The file "boost/coroutine/&lt;platform&gt;/protected_stack_allocator.hpp" would contain function prototypes something like: </p> <pre class="wiki">void * allocate_protected_memory(size_t) void free_protected_memory(void *) </pre><p> in boost::detail namespace to just allocate protected stack memory area (no original pointer adjusting) and the protected_stack_allocator template that uses the function prototypes. The compiled file then implements the prototypes and the platform depend stuff would be hidden from library user. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10697 Trac 1.4.3 olli Sat, 25 Oct 2014 13:45:51 GMT <link>https://svn.boost.org/trac10/ticket/10697#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10697#comment:1</guid> <description> <p> Replying to <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/10697" title="#10697: Bugs: Boost coroutine leaks windows.h into global namespace (closed: worksforme)">jarmo.tiitto@…</a>: </p> <blockquote class="citation"> <p> I was surprised that file "boost/coroutine/windows/protected_stack_allocator.hpp" from coroutine library from boost release 1.56.0 version just insanely includes windows.h in public header without any protection from the header leaking into global namespace severely polluting it. </p> </blockquote> <p> ? windows.h is a system header from Windows, it is legitmi to include it in windows-related code - I don't know why you say 'insanely' etc. </p> <blockquote class="citation"> <p> Because of this 'boost/coroutine/protected_stack_allocator.hpp' is rendered UNUSABLE/BROKEN on windows (all compilers) and namespace pollution may apply to <a class="missing wiki">Unix/Linux</a> as well. The feature is released very hacky and unfinished way by having such code issues. </p> </blockquote> <p> it is protected by '#if defined(BOOST_WINDOWS)' - why should this pollute <a class="missing wiki">Unix/Linux</a>? if you think the library is hackish - than don't use it </p> </description> <category>Ticket</category> </item> <item> <dc:creator>olli</dc:creator> <pubDate>Tue, 28 Oct 2014 07:57:26 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10697#comment:2 https://svn.boost.org/trac10/ticket/10697#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> </ul> Ticket