std.data.json formal review
deadalnix via Digitalmars-d
digitalmars-d at puremagic.com
Tue Aug 18 10:05:15 PDT 2015
On Tuesday, 18 August 2015 at 16:22:20 UTC, Andrei Alexandrescu
wrote:
> On 8/18/15 11:39 AM, Johannes Pfau wrote:
>> No, this won't improve the ASM much: Enum values start at 0
>> and are
>> consecutive. With a final switch they're also bounded. All
>> these points
>> do not apply to pointers. They don't start at 0, are not
>> guaranteed to
>> be consecutive and likely can't be used with final switch.
>> Because of
>> that a switch on pointers can never use jump tables.
>
> I agree there's a margin here in favor of integers, but it's
> getting thin. Meanwhile, pointers maintain large advantages of
> principle. I suggest we pursue better use of pointers as tags
> instead of adding integral-tagged unions to phobos. -- Andrei
No, enum can also be cramed inline in the code for cheap, they
can be inserted in existing structure for cheap using bits
manipulations most of the time, the compiler can check that all
cases are handled in an exhaustive manner.
It is not getting thinner.
More information about the Digitalmars-d
mailing list