@foone@digipres.club i will take this opportunity to once again tell tale of the time i worked on an embedded device with a firmware written in C, roughly a 150,000-line codebase on a little STM32 chip
the original author of the code base did not, in fact, seem to understand what an array was.
the device communicated to another device bolted to the same machine, using MODBUS. with potentially up to 10,000 MODBUS registers storing data, but realistically only a few actually in use.
the file defining the structure where the data was stored for the registers simply made a struct, with elements starting at "reg0" and incrementing up to "reg10000". the implementation file was just as bad.
this is why the codebase was roughly 150,000 lines. it should have been perhaps 5000.
the code used a small function that did pointer math in order to actually access the register, usually, unless it was referenced directly in code, or sometimes used a macro instead.
none of this was even the worst offense within the codebase.
the original author of the code base did not, in fact, seem to understand what an array was.
the device communicated to another device bolted to the same machine, using MODBUS. with potentially up to 10,000 MODBUS registers storing data, but realistically only a few actually in use.
the file defining the structure where the data was stored for the registers simply made a struct, with elements starting at "reg0" and incrementing up to "reg10000". the implementation file was just as bad.
this is why the codebase was roughly 150,000 lines. it should have been perhaps 5000.
the code used a small function that did pointer math in order to actually access the register, usually, unless it was referenced directly in code, or sometimes used a macro instead.
none of this was even the worst offense within the codebase.