Re: Feedback on string-convert branch
Tim Mayberry <[email protected]> Thu, 12 Jan 2017 23:15:54 +1000
| Newsgroups | gmane.comp.audio.ardour.devel |
|---|---|
| Message-ID | <CAM2edBjg2y4e8DZiDcQb5qkDq_VgATMAjxeVb75BQhaPywzxUw@mail.gmail.com> |
On Thu, Jan 12, 2017 at 12:33 AM, John Emmas <[email protected]> wrote: > On 10/01/2017 19:04, John Emmas wrote: > >> >> My guess is that with those specific types (LayerModel / BufferingPreset >> etc) the DEFINE_ENUM_CONVERT macro is somehow getting called with a type >> that's considered invalid (and it therefore ends up at >> T::TO_STRING_TEMPLATE_NOT_DEFINED_FOR_THIS_TYPE). >> >> The affected types (at least, the ones I've looked at so far) appear to >> be enums - so maybe there's some difference in the way VC++ handles enums, >> compared to gcc? >> >> > Yes, the problem seems to be specific to enum types - and in fact, Tim's > code is doing exactly what it's designed to do (i.e. it's trapping out an > invalid data type). > > In gcc, enums are most likely implemented via one of the basic types > ('int' maybe?) But for MSVC, 'enum' seems to be a type in its own right. > I found a few sites which seemed to suggest that it's effectively 'const > int' so I changed Tim's functions to require const parameters (like this > example):- > > template <class T> > inline bool to_string (int32_t val, std::string& str) > { > return int32_to_string (val, str); > } > > which got changed to this:- > > template <class T> > inline bool to_string (const int32_t val, std::string& str) > { > return int32_to_string (val, str); > } > > However, for enum types, that still doesn't make any difference and I'm > not sure what else I can try. I've asked for help on an MSVC programming > forum but unless someone comes up with a solution, it looks like merging in > the string_convert stuff might make Ardour unbuildable with MSVC... :-( Hi John, I haven't had much time to look into this over the last few days but I did write a basic test case for Visual Studio 2015/MSVC14 and it seems the template specialization for enum types works as expected/correctly. It is fairly basic use of templates so I'd be surprised if there was a problem with that part of the code. Are you also building the libpbd unit tests as part of your MSVC build? and do they pass? I'm not setup to build libardour/libpbd and dependencies with MSVC but I'll continue to try and expand the test case to reproduce your issue. Can you please send me (privately) the relevant compiler error/output. Thanks, Tim _______________________________________________ ardour-dev mailing list [email protected] http://lists.ardour.org/listinfo.cgi/ardour-dev-ardour.org