lkml.org 
[lkml]   [2008]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] BUILD_BUG_ON sucks


    On Sat, 16 Aug 2008, Rusty Russell wrote:
    >
    > Interesting idea, but I've come to actually like the semantic explicitness of
    > BUILD_BUG_ON. There's a difference between "we should never get here"
    > and "this should never exist".

    Agreed. I think Alexey's patch is broken.

    The thing is, BUILD_BUG_ON() is a different thing. It says "this is a
    build error", while BUG_ON() says "this is an error if we reach it".

    Very different.

    The fact that you broke BUG_ON(1) should have made you think. Sometimes
    the "1" isn't necessarily a constant one. It might be

    if (something_that_can_never_happen_in_some_configuration) {
    ...
    BUG_ON(CONFIG_XYZZY);
    ...
    }

    where the BUG_ON(1) is absolutely *not* the same thing as BUILD_BUG_ON().

    Linus


    \
     
     \ /
      Last update: 2008-08-16 22:11    [W:9.191 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site