On 18/10/17 09:38, Rick C. Hodgin wrote:
> Is there a proper name for exploiting otherwise unused data space,
> such as in the example I gave, which does not alter program behavior,
> but does introduce additional data conveyance mechanisms atop legacy
> code bases (for example)?
I don't know of any name - perhaps "tagging" of some sort?
I am sceptical to the idea of applying this to unchanged existing code.
Either it /will/ change program behaviour to at least some extent, or
it is going to be unreliable. For example, if you try to use values
other than 0 or 1 in place of a boolean, to convey additional
information, then there are three things that can go badly wrong. One
is that any use of "bool", "!!", or similar constructs, will wipe the
extra information. Another is that code that expects the value to be
either 0 or 1, will break. Finally, the existing code could already be
using the extra bits for its own purposes in exactly the same way.
It is a different matter if you are talking about a C++ type with
careful access control, and you change the type itself - if all access
to the data members, copying, etc., happens via methods that /you/
control, you can add more information and safely re-compile the code
that uses it. But for low-level types, you would have to be sure that
the legacy code uses them safely.
It is certainly possible to make use of otherwise unused space in types
- look up "tagged pointer" for an example. But that is done in
cooperation with code that uses the pointer, not as an add-on to
existing code.