[mythtv] Compile error "invalid cast"

Peter Bennett pb.mythtv at gmail.com
Fri Oct 5 22:16:29 UTC 2018



On 10/04/2018 10:16 PM, David Hampton wrote:
> On Thu, 2018-10-04 at 17:01 -0400, David Hampton wrote:
>> On Thu, 2018-10-04 at 13:01 -0400, Peter Bennett wrote:
>>> Hi David
>>>
>>> I am getting this error compiling master on raspberry pi. Do you
>>> know
>>> what caused it? My response would be to change it to the simple
>>> cast
>>> (unsigned char*) (h), but maybe there is a better way, or maybe
>>> that
>>> will not work.
>>>
>>> videoout_omx.cpp:62:77: error: invalid cast from type
>>> ‘std::nullptr_t’
>>> to type ‘unsigned char*’
>>>    #define FRAMESETHDR(f,h) ((f)->priv[3] =
>>> reinterpret_cast<unsigned
>>> char* >(h))
>>> ^
>>> videoout_omx.cpp:1417:9: note: in expansion of macro ‘FRAMESETHDR’
>>>            FRAMESETHDR(vf, nullptr);
>>>            ^
>> It seems that nullptr and reinterpret_cast don't play well together.
>> There's even something about it on the cppreference pages.  I'm
>> working
>> on a fix and should have it committed soon.  The test compiles also
>> turned up a couple of other instances of '0' that should be nullptr,
>> so
>> I'm fixing those too.
>>
> The changes have been committed.
>
> David
>
>

Thank you David. It is working now.

I assume this means we should use "nullptr" instead of NULL or 0 in 
future when setting a pointer to null.

Peter




More information about the mythtv-dev mailing list