[Mesa-dev] [PATCH 0/6] glsl: Add support for switch statements
Dan McCabe
zen3d.linux at gmail.com
Sun Jun 19 14:42:56 PDT 2011
On 06/19/2011 02:21 PM, Eric Anholt wrote:
> On Sat, 18 Jun 2011 09:29:32 +0200, Keith Packard<keithp at keithp.com> wrote:
>> On Fri, 17 Jun 2011 17:43:14 -0700, Dan McCabe<zen3d.linux at gmail.com> wrote:
>>
>>> break; // implicit exit from loop at end of switch
>>> } while (true);
>> Seems like this could just be
>>
>> } while (false);
>>
>> as I don't see any way the loop could go around more than once.
> "while (true)" is the instruction available in the hardware, this isn't
> a description of C code.
Correct. It is primarily intended to explain approximately an equivalent
for the underlying code and is intended to interpreted with a grain of
salt. It is really pseudo-code that looks a lot like C :).
I also wanted to use "while(true)" to explicitly indicate the actual
effect of the implicit "break" at the end of the "loop". With
"while(false)", you have to scratch your head to figure out why that
final "break" is there, because it ought not be needed in a
"while(false)" loop.
More information about the mesa-dev
mailing list