Re: [PATCH 01/10] Add support for GCC-4.5's __builtin_unreachable() to compiler.h

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

 



Geert Uytterhoeven wrote:
On Fri, Sep 11, 2009 at 17:58, David Daney<ddaney@xxxxxxxxxxxxxxxxxx> wrote:
Michael Buesch wrote:
On Friday 11 September 2009 01:56:42 David Daney wrote:
+/* Unreachable code */
+#ifndef unreachable
+# define unreachable() do { for (;;) ; } while (0)
+#endif
# define unreachable() do { } while (1)

? :)
Clearly I was not thinking clearly when I wrote that part.  RTH noted the
same thing.  I will fix it.

However, people are so used to seeing the `do { } while (0)' idiom,
that they might miss
there's a `1' here, not a `0'.

So perhaps it's better to use plain `for (;;)' for infinite loops?


I don't think so. The only valid token that can follow 'do { } while (1)' is ';', any statement may follow 'for (;;)', so there is a greater possibility to silently screw things up with the for(;;) form.

David Daney

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

[Index of Archives]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux