[Ardour-Dev] Feedback on string-convert branch

John Emmas johne53 at tiscali.co.uk
Wed Jan 11 06:33:27 PST 2017


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... :-(

John



More information about the Ardour-Dev mailing list