using namespace std; in C4D SDK
-
On 30/07/2016 at 08:27, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R17
Platform: Mac ;
Language(s) : C++ ;---------
I'm wondering why on OSX the C4D SDK is doing "using namespace std;"? That is in c4d_string.h,
c4d_memory.h and c4d_basecontainer.h. I'd like to know the reasoning behind it, because currently
it requires me to refactor a lot of code that was developed on Windows that implemented its own
"thread" class, causing name ambiguation on OSX (compile error).I'd personally consider it bad practice to do "using namespace" in a header file, but I'm 99% sure
that there's good reasoning behind it.Thanks,
NiklasUpdate: The C4D SDK compiles without any problems after commenting out the "using namespace std;"
lines in the above three files (I verified that its the only ones). No I'm only 10% sure that there is good
reasoning behind it. -
On 30/07/2016 at 09:45, xxxxxxxx wrote:
Originally posted by xxxxxxxx
<ADDRESS>
User Information:
Cinema 4D Version: R17
Platform: Mac ;
Language(s) :
C++ ;---------
</ADDRESS>I'm wondering why on OSX the C4D SDK is doing "using namespace std;"? That is in <span style="line-height: 1.4;">c4d_string.h,</span>
<span style="line-height: 1.4;">c4d_memory.h and c4d_basecontainer.h. I'd like to know the reasoning behind it, because currently</span>
<span style="line-height: 1.4;">it requires me to refactor a lot of code that was developed on Windows that implemented its own</span>
<span style="line-height: 1.4;">"thread" class, causing name ambiguation on OSX (compile error).</span>
<span style="line-height: 1.4;"></span>
I'd personally consider it bad practice to do "using namespace" in a header file, but I'm 99% sure
that there's good reasoning behind it.
<span style="line-height: 1.4;"></span>
<span style="line-height: 1.4;">Thanks,</span>
<span style="line-height: 1.4;">Niklas</span>
<span style="line-height: 1.4;"></span>
<span style="line-height: 1.4;">Update: The C4D SDK compiles without any problems after commenting out the "using namespace std;"</span>
lines in the above three files (I verified that its the only ones). No I'm only 10% sure that there is good
reasoning behind it.There was a reason for this until R16 (when the legacy API was still supported). It should have been removed with R17 (but it slipped through); it was already removed in the R18 SDK though ...
Best regards,
Wilfried
-
On 02/08/2016 at 04:21, xxxxxxxx wrote:
Thanks Wilfried, for the information.
Cheers,
Niklas