switch case for constants-only?
Nick Sabalausky
a at a.a
Sat Dec 5 14:19:08 PST 2009
"Ellery Newcomer" <ellery-newcomer at utulsa.edu> wrote in message
news:hfekll$pbl$1 at digitalmars.com...
> On 12/05/2009 03:39 PM, Nick Sabalausky wrote:
>> "Steven Schveighoffer"<schveiguy at yahoo.com> wrote in message
>> news:op.u4hhjisgeav7ka at localhost.localdomain...
>>> On Sat, 05 Dec 2009 16:08:00 -0500, Nick Sabalausky<a at a.a> wrote:
>>>
>>>> I just noticed in D1 that the values for the cases in a switch must be
>>>> known
>>>> at compile-time (btw, the docs don't seem somewhat vague on that). Is
>>>> this
>>>> also true in D2? If so, I don't suppose we could get that changed
>>>> before
>>>> the
>>>> book? It's a real PITA for dynamic code.
>>>
>>> you mean a real PITA to use if instead of switch?
>>
>> For long "if else(x == y)" chains where the x is always the same? Yes,
>> absolutely.
>>
>
> More so than remembering to type break after each case block?
Good point, but that's really a separate issue.
More information about the Digitalmars-d
mailing list