Skip to content

OIL 41, chapter Types: the library - #129

Merged
theAndreas merged 2 commits into
mainfrom
oil-41-types
Nov 17, 2026
Merged

theAndreas merged 2 commits into
mainfrom
oil-41-types

Conversation

@theAndreas

Copy link
Copy Markdown
Owner

Nothing changes for a sketch but its size: every example is 8 bytes of flash smaller on the Uno, in all three variants (bit banging, SPI, MAXMATRIX_DEV_ERROR_DETECT), Shutdown 12 and SerialControl 22; RAM is the same.

The first pull request of the review of the chapter Types of the coding style in OIL item 41, for the library; the host code follows. The rules review checks there, as the tools already pass:

  • T-14, one side effect per statement: a char of a command line is stored and the line's length counted in two statements now, and turning the mapping walks its pairs of modules by one counter rather than two moved in one expression.
  • T-13, a variable where it is first needed: the header of a font is read into a struct by one function, where two functions each declared four variables ahead and assigned them per version, which also takes a copy that the review of the chapter Functions missed; a command with a value is passed on by a function of its own, where its status was declared ahead.
  • T-18, an expression does one thing: a condition of three parts and a sum inside a condition are named steps.
  • T-8: the one auto whose type does not stand in its line says why it cannot be written: the register is a byte on the board and an object of the mock's on the host.

Nothing to change for T-1, T-19 and T-23.

Checked:

  • make check passes: lint, clang-tidy, every host and AVR test, coverage at 100 % of lines, branches and conditions.
  • Not run on hardware; the frames on the wire do not change.

A char is stored and the line's length counted in two statements (T-14),
and ChangeMapping() walks its pairs of modules by one counter rather than
two in one declaration (T-13, T-14). The header of a font is read by one
function into a struct, where CheckFont() and GetGlyph() each assigned
four variables declared ahead (T-13), which also takes a copy the chapter
Functions missed (FN-13). Command passes a command with a value on in a
function of its own (T-13). A condition of three parts and a sum in a
condition are named steps (T-18), and the auto of a port register says
why its type cannot be written (T-8).

On the Uno, in every variant, every example is 8 bytes of flash smaller,
Shutdown 12 and SerialControl 22; RAM is the same.
@theAndreas
theAndreas merged commit dbf0efa into main Nov 17, 2026
12 checks passed
@theAndreas
theAndreas deleted the oil-41-types branch November 17, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants