[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 4/8] target/mips: Avoid case statements formu
From: |
Aleksandar Markovic |
Subject: |
Re: [Qemu-devel] [PATCH v3 4/8] target/mips: Avoid case statements formulated by ranges |
Date: |
Fri, 6 Jul 2018 09:04:48 +0000 |
> > case 18:
> > switch (sel) {
> > - case 0 ... 7:
> > + case 0:
> > + case 1:
> > + case 2:
> > + case 3:
> > + case 4:
> > + case 5:
> > + case 6:
> > + case 7:
>
> I don't see the point in this. It is clear what 0 ... 7 means.
The point is to avoid using ranges altogether, regardless of the clarity of a
particular instance.
Let me further explain the reason: Consider this: Let's say we plan to replace
0, 1, 2, 3, 4, 5, 6, 7 with some preprocessor constants, appropriate for the
particular context. If we keep "0 ... 7" notation, that line will look like
"case ABC_KLM ... ABC_RST:" and will suddenly become much less clear.
As a mattter of fact, there is a plan to switch from hardcoded numbers to
preprocessor constants in this instance, but it is a low priority task.
Regards,
Aleksandar
- Re: [Qemu-devel] [PATCH v3 1/8] target/mips: Update maintainer's email addresses, (continued)
[Qemu-devel] [PATCH v3 6/8] target/mips: Amend CP0 WatchHi register implementation, Aleksandar Markovic, 2018/07/04
[Qemu-devel] [PATCH v3 7/8] target/mips: Don't update BadVAddr register in Debug Mode, Aleksandar Markovic, 2018/07/04