Skip to contentSkip to conversation

Remove useless assertions from reiserfs

PATCH Petr Vandrovec 2 participants 2 messages Aug 11, 2003

lore
Share & tools
lore
#0 lore raw
Quoted 19 lines · On 11 Aug 03 at 14:00, [email protected] wrote:
Quoted 9 lines · Jeff Garzik

Why are these useless?

Quoted 5 lines
    if (len >= 12)
    {          
     //assert(len < 16);
              if (len >= 16)
                   BUG();

Seems like a valid check to me...

Just before that, there's code:

     while(len >= 16)
        {
    ...
                len -= 16;
            }
Quoted 3 lines

So if that ever exits with a len >=16, we have a SERIOUS problem with either the compiler or the hardware - as such, that "if (..) BUG" is dead code. Similarly for the other checks.

I always thought that assertions are just for that - if you can hit them without some unexpected event/bug, you have a SERIOUS problem.
Petr Vandrovec

#1 lore raw
Quoted 2 lines · Petr Vandrovec

I always thought that assertions are just for that - if you can hit them without some unexpected event/bug, you have a SERIOUS problem.

Not for when you explicitly code things above so it really cannot happen. An assertion is more for the case "I really hope someone doesn't pass me x in state y" type assertions than "I really hope the compiler did the right thing with the previous loop"

Dave

Signature · 1 line
 Dave Jones     http://www.codemonkey.org.uk