[Ardour-Dev] Feedback on string-convert branch

Tim Mayberry mojofunk at gmail.com
Thu Jan 12 05:15:54 PST 2017

On Thu, Jan 12, 2017 at 12:33 AM, John Emmas <johne53 at tiscali.co.uk> 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
>> 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.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ardour.org/pipermail/ardour-dev-ardour.org/attachments/20170112/75161c27/attachment-0001.htm>

More information about the Ardour-Dev mailing list