Mac build fails, PC build OK



  • I have converted an R16-R19 plugin to R20 on PC.
    After resolving all compiler issues. I copy the adjusted source files, res files to Mac.
    There the build reports

    No viable conversion from 'maxon::Bool' (aka 'bool') to 'Result<void>'
    

    and this for line 2286 in apibase.h

    Result<void> res = dst.CopyFrom(src);
    

    It seems related to a class I provided, disallowing copy and assign. And for which I have provided a CopyFrom method.
    Strangly enough, I have provided

    class MyObject
    {
    MAXON_DISALLOW_COPY_AND_ASSIGN(MyObject);
    
    public:
    ...
    maxon::Bool CopyFrom(const MyObject& src);
    

    A return type of maxon::Bool, which is also mentioned in the Code Style Guide point 9.6.

    while the R19 documentation indicates

    MAXON_WARN_UNUSED Result<void> CopyFrom(const Example1& src)
    

    Looking at my code, it seems I got it wrong.
    The R16-R19 implementation uses a Bool as return type, while it should be a Result<void>, still all compiles fine, and runs fine as well. (both PC and Mac)
    The R20 implementation uses a Bool, which should be OK according to the documentation, compiles fine on PC but that fails to compile on Mac.

    EDIT:
    The R20 SDK example (Move/Copy Constructors) also contains:

    maxon::Result<void> CopyFrom(const Example3& src)
    

    I am confused



  • Think I got it resolved.
    Seems the correct implementation should indeed be

    maxon::Result<void> CopyFrom(const Example3& src)
    

    as the arraytutorial.cpp and movecopyconstructor.cpp examples from the R20 SDK indicate.

    Please update the Code Style Guide point 9.6 to show the correct way to go for a CopyFrom.
    Thanks for watching.



  • I had a "deja vu" moment, and indeed ... seems I already once hit that same wall here

    Funny that Visual Studio never once complained about the maxon::Bool CopyFrom.



  • Bringing this back to the attention, as it might have been lost during the holiday period.

    The Code Style Guide (section 9.6) shows

    class Test
    {
      MAXON_DISALLOW_COPY_AND_ASSIGN(Test)
    private:
      Int _value[5];
    };
    class Test
    {
      MAXON_DISALLOW_COPY_AND_ASSIGN(Test)
    public:
      Bool CopyFrom(const Test& source);
    private:
      Int _value[5];
    };
    

    where the CopyFrom should actually not return a Bool but a maxon::Result<void>.



  • This is probably due to the Docs have not been updated in this regard.
    maxon::Result<> is indeed correct. You can look it up here: https://developers.maxon.net/docs/Cinema4DCPPSDK/html/page_maxonapi_transition.html#page_maxonapi_transition_code_error



  • @mp5gosu
    I know, that's why I mention it again ... to please update the Code Style code snippet.



  • Hi,

    we are sorry, you ran into this issue, especially as our guide seems to have led you on a wrong path. And I apologize, we (although I'd rather blame the bearded guy with red coat) obviously did miss your post. Sorry!
    We'll see to get the code style guide updated.

    Cheers,
    Andreas



  • @a_block
    No need for apologies.
    I thought the bearded guy had something to do with it ...
    Hence the reason I posted the message again. Luckily, JIT before the easter bunny was to blame.