[Ffmpeg-devel] [PATCH] Wildcard and catalog image sequences
Michel Bardiaux
mbardiaux
Mon Sep 4 14:38:22 CEST 2006
M?ns Rullg?rd wrote:
> Michel Bardiaux said:
>> M?ns Rullg?rd wrote:
>>> Michael Niedermayer said:
>>>> Hi
>>>>
>>>> On Wed, Aug 30, 2006 at 02:28:57PM +0200, Michel Bardiaux wrote:
>>>>> Michael Niedermayer wrote:
>>>>>> looking at for example:
>>>>>>
>>>>>>>> +int filename_catalog_test(const char *filename)
>>>>>>>> +{
>>>>>>>> + if(!filename)
>>>>>>>> + return (-1);
>>>>>>>> + else if(filename[0]=='@')
>>>>>>>> + return 0;
>>>>>>>> + else
>>>>>>>> + return (-1);
>>>>>> versus
>>>>>>
>>>>>>> return filename && filename[0]=='@';
>>>>>> i cant see how the later is more obfuscated, additionally
>>>>> I dont mean all one-liners are obfuscated, only that they quickly become
>>>>> so. Esp. since the correct one is
>>>>>
>>>>> return (filename && filename[0]=='@')?0:-1; // justified below.
>>>>>
>>>>> Still reasonable, but the one about wildcards is even bigger. If one has
>>>>> to code for multiple levels of conditions, nested ?: become quite
>>>>> unreadable. So there is a limit to one-liners, and where it is is a
>>>>> matter of taste, isnt it?
>>>> sure but my suggestion wouldnt need the ?: and without that the one liner
>>>> really seems to be the better solution
>>> return -(filename && filename[0] == '@');
>> That gives -1 for OK and 0 for KO, the opposite of what is wanted!
>
> Darn. OK, these two should give the right result:
>
> return -!(filename && filename[0] == '@');
>
> return (filename && filename[0] == '@')-1;
>
Yes, but besides my point, which was that excessive perlitism is just as
dangerous as excessive bloat. Anyway, that API has now been changed, and
I have sworn to be as terse as Michael has requested (against my better
judgment, but unfortunately I dont have the same credentials here as in
my daytime job!).
--
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be
Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/
More information about the ffmpeg-devel
mailing list