[Csnd-dev] switch statement verification
| Date | 2025-10-21 06:56 |
| From | Scott Sitar |
| Subject | [Csnd-dev] switch statement verification |
Hello, Based on the discussion around the switch statement and whether there should be an implicit break or not, I've been learning about how it's expanded out during compilation to see how hard it would be to implement something like a golang "fallthrough" opcode. I ran into the following interesting example, where it seems like we don't insist that the default case comes last, and we allow multiple default cases (only the first will match). Should we be more strict, and implement some of these rules inside a verify_switch_statement(), similar to the looping opcode verifications? We could also put the rule in there to enforce the fallthrough opcode being the last opcode of the block, and disallowing it in the default block. I've pasted the example I was playing with at the bottom. I'd be happy to work on the verification and/or the new opcode if folks think it's worthwhile. Best, Scott ========= |
| Date | 2025-10-21 08:48 |
| From | Hlöðver Sigurðsson |
| Subject | Re: [Csnd-dev] switch statement verification |
that's a good idea to improve the semantics checker. I could look into it, made a ticket https://github.com/csound/csound/issues/2316 On Tue, 21 Oct 2025 at 08:56, Scott Sitar <scottsitar@gmail.com> wrote: Hello, |
| Date | 2025-10-21 15:23 |
| From | Scott Sitar |
| Subject | Re: [Csnd-dev] switch statement verification |
Sounds good, thanks! Scott On Tue, Oct 21, 2025 at 12:48 AM Hlöðver Sigurðsson <hlolli@gmail.com> wrote:
|