[vlc-devel] [PATCH v6 4/5] video_filter-sharpen: assert that SHARPEN_FRAME macro's maxval parameter is positive

Rémi Denis-Courmont remi at remlab.net
Wed Apr 12 16:57:18 CEST 2017


On April 12, 2017 11:28:56 AM GMT+03:00, "Filip Roséen" <filip at atch.se> wrote:
>Hi Hugo,
>
>On 2017-04-12 10:14, Hugo Beauzée-Luyssen wrote:
>
>> On Tue, Apr 11, 2017, at 11:39 PM,
>victorien.lecouviour.tuffet at gmail.com
>> wrote:
>> >      \
>> > +        assert((maxval) >= 0);                                    
>    
>> > \
>> >          data_t *restrict p_src = (data_t
>*)p_pic->p[Y_PLANE].p_pixels; 
>> >          \
>> >          data_t *restrict p_out = (data_t
>> >          *)p_outpic->p[Y_PLANE].p_pixels; \
>> >          const unsigned data_sz = sizeof(data_t);                  
>    
>> >          \
>> 
>> static_assert seems like a better choice here
>
>The current usage only involves *constant-expressions*, but the macro
>itself does not restrict itself to such (as `maxval` of course doesn't
>have to be a *constant-expression* for things to work as they should).
>
>For what it's worth; I vote keeping the `assert`.

The use of a giant macro is highly questionable if we allow the parameters to become variable though.

(In fact, the compiler might even be able to expand the different constant values even without​ the big macro.)
-- 
Rémi Denis-Courmont
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170412/7dcb53e0/attachment.html>


More information about the vlc-devel mailing list