Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    using namespace std; in C4D SDK

    SDK Help
    0
    3
    370
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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,
      Niklas

      Update: 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. Tongue

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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. Tongue

        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

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 02/08/2016 at 04:21, xxxxxxxx wrote:

          Thanks Wilfried, for the information.

          Cheers,
          Niklas

          1 Reply Last reply Reply Quote 0
          • First post
            Last post