I agree. There is no good reason for doing this at all. It looks like someone 
has intentionally obfuscated the code. If it's for throwing an error on invalid 
configurations, other constructs exist that are much more clear and are better 
supported.

This is arguably a prime example of a poor coding practice (being clever is 
almost always a future maintainability nightmare) and should not be accepted 
into BusyBox without being rewritten in a maintainable way, including detailed 
comments explaining why and how it does what it does.

Jody Bruchon

On October 13, 2015 6:23:46 AM EST, walter harms <wha...@bfs.de> wrote:
>maybe that is a clever solution,
>but it causes the code to be unreadable.
>(read:no chance to understand before unterstanding
> this typedef and its consequences)
>
>
>just my 2 cents,
>
>re,
> wh
>
>Am 05.10.2015 19:04, schrieb Denys Vlasenko:
>> On Sat, Oct 3, 2015 at 12:58 PM, Xabier Oneca  --  xOneca
>> <xon...@gmail.com> wrote:
>>> Hello,
>>>
>>> Excuse my ignorance, but what does this typedef do?
>>>
>>> ------------------
>>>     {
>>>         typedef char bug[
>>>             (OPT_FORCE != MNT_FORCE || OPT_LAZY != MNT_DETACH) ? -1
>: 1
>>>         ];
>>>     }
>>> ------------------
>>>
>>> My understanding is that this snippet catches when those two
>constants
>>> are not equal and then trigger a compiler error by defining a
>char[-1]
>>> type. Am I correct? If so, why isn't used the preprocessor #errror
>>> with a less cryptic error description?
>> 
>> Constants like MNT_FORCE may be enums, not literals.
>> Preprocessor can't evaluate enums.
>> _______________________________________________
>> busybox mailing list
>> busybox@busybox.net
>> http://lists.busybox.net/mailman/listinfo/busybox
>> 
>_______________________________________________
>busybox mailing list
>busybox@busybox.net
>http://lists.busybox.net/mailman/listinfo/busybox

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to