Re: [PATCH 1/4] sha1-lookup: add new "sha1_pos" function to efficiently lookup sha1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 05, 2009 at 12:17:32PM +0200, Sverre Rabbelier wrote:

> On Sat, Apr 4, 2009 at 22:59, Christian Couder <chriscool@xxxxxxxxxxxxx> wrote:
> > +                               if (lo <= mi && mi < hi)
> > +                                       break;
> > +                               die("oops");
> 
> That's going to be an official git error message? Why not make it "The
> fatal error oops has occured, press ctrl-c to lose all your work, or
> press any other key to do the same"?

>From my cursory reading of the code, this is a "cannot happen"
assertion (and there is one a few lines below, too):

+                               die("oops");
+                       }
+               }
+               if (18 <= ofs)
+                       die("cannot happen -- lo and hi are identical");
+       }

I don't think we have an established style for such assertions. In
theory, users never see it, but the whole point of it being there is
that they _might_. :) One could use the "assert" macro, though I think
its output is just as cryptic to end users. I usually do

  die("BUG: <something that makes a little bit of sense to the user>");

some examples of which you can see via "git grep BUG:".

Of course, "binary search on fire?" would probably work, too.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux