Thread overview | |||||
---|---|---|---|---|---|
|
June 10, 2015 [Issue 3233] final switch could skip bounds checking in release mode | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=3233 Andrei Alexandrescu <andrei@erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|future |D2 -- |
December 19, 2020 [Issue 3233] final switch could skip bounds checking in release mode | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=3233 --- Comment #1 from ponce <aliloko@gmail.com> --- For example: See godbolt output in https://d.godbolt.org/z/7x3Ehd --------------- switch.d --------------------- enum LOL { a, b, c } import core.stdc.stdio; void dosmthg(LOL l) { assert(l >= LOL.a); assert(l <= LOL.c); final switch(l) with (LOL) { case a: printf("hello"); case b: printf("world"); case c: printf("!!!!"); } } ---------------------------------------------- The final switch always has a default case that call core.internal.switch_error I'm not really if this is a good thing or not. On one hand, it's like a enabled-on-release assertion so a good idea. On the other hand, it's one more test in a final switch that could assume all values are inside range. Maybe it's better to err on the side of safe. -- |
December 17, 2023 [Issue 3233] final switch could skip bounds checking in release mode | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=3233 --- Comment #2 from ponce <aliloko@gmail.com> --- Please close this :) -- |
Copyright © 1999-2021 by the D Language Foundation