[Toybox] [PATCH] bc.c: deobfuscation of bc_lib
Mouse
mouse at Rodents-Montreal.ORG
Tue Feb 27 12:00:13 PST 2024
> And also, bc_program_stdin_name never changes from "<stdin>" so
> there's no reason to make it a variable
Well, I haven't read all the context. But I would say that there is at
least potentially reason to leave it as a variable even if it's never
changed: namely, future-proofing. If someone wants to change it in the
future, it's significantly easier to change one variable initialization
than to chase down everywhere that string is hardwired and check that
each one actually is referring to the same thing. (It's easy to find
all strings that say <stdin>. It's less easy to verify that each of
those is actually talking about the semantic bc_program_stdin_name
refers to.)
If it were performance-critical enough that the cost of dereferencing a
variable were significant (and, for that small a difference, if it were
under my umbrella I'd want to see measurements), then it might be worth
doing. While, as I say, I haven't checked in detail, I suspect that is
not the case here.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse at rodents-montreal.org
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
More information about the Toybox
mailing list