[PATCH 4/5] a68: minor readability improvement
Mohammad-Reza Nabipoor
mnabipoor@gnu.org
Mon Dec 15 10:40:46 GMT 2025
Hi Jose.
On Mon, Dec 15, 2025 at 09:09:17AM +0100, Jose E. Marchesi wrote:
>
> This is subjective but I don't see how this improves readability. The
> GA68_EXTRACT_* values are not an ordered set, the particular constant
> values are basically arbitrary, and there is no logical sequence in
> handling the different extracts.
I was debugging extracts with poke, and I was confused for a while before
I understood the order in C++ code is different from the order in specification.
And exactly because these are arbitrary numbers from 0 to 4, when seeing a value 1,
it's easier to find the 2nd case and see what it does, instead of memorizing that
value 1 is for GA68_EXTRACT_IDEN.
That's my reasoning why this improves readability.
>
> > Signed-off-by: Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
> >
> > gcc/ChangeLog
> >
> > * algol68/a68-exports.cc (a68_asm_output_extract): Re-order
> > cases in switch statement to be sorted based on the
> > GA68_EXTRACT_* values.
> > ---
> > gcc/algol68/a68-exports.cc | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/gcc/algol68/a68-exports.cc b/gcc/algol68/a68-exports.cc
> > index 375b6213cef..0a30edf5e74 100644
> > --- a/gcc/algol68/a68-exports.cc
> > +++ b/gcc/algol68/a68-exports.cc
> > @@ -402,17 +402,17 @@ a68_asm_output_extract (const char *module_label, int kind,
> > dw2_asm_output_data (1, GA68_EXTRACT_MODU, "module extract %s", symbol);
> > a68_asm_output_string (symbol, "module indication");
> > break;
> > - case GA68_EXTRACT_MODE:
> > - dw2_asm_output_data (1, GA68_EXTRACT_MODE, "mode extract %s", symbol);
> > - a68_asm_output_string (symbol, "mode indication");
> > - dw2_asm_output_delta (PTR_SIZE, ASM_LABEL (mode), module_label, "mode");
> > - break;
> > case GA68_EXTRACT_IDEN:
> > dw2_asm_output_data (1, GA68_EXTRACT_IDEN, "identifier extract %s", symbol);
> > a68_asm_output_string (symbol, "name");
> > dw2_asm_output_delta (PTR_SIZE, ASM_LABEL (mode), module_label, "mode");
> > encode_mdextra = true;
> > break;
> > + case GA68_EXTRACT_MODE:
> > + dw2_asm_output_data (1, GA68_EXTRACT_MODE, "mode extract %s", symbol);
> > + a68_asm_output_string (symbol, "mode indication");
> > + dw2_asm_output_delta (PTR_SIZE, ASM_LABEL (mode), module_label, "mode");
> > + break;
> > case GA68_EXTRACT_PRIO:
> > dw2_asm_output_data (1, GA68_EXTRACT_PRIO, "prio extract %s", symbol);
> > a68_asm_output_string (symbol, "opname");
>
More information about the Algol68
mailing list