Skip to content

OIL 41, chapter Classes - #132

Merged
theAndreas merged 4 commits into
mainfrom
oil-41-classes
Nov 17, 2026
Merged

theAndreas merged 4 commits into
mainfrom
oil-41-classes

Conversation

@theAndreas

Copy link
Copy Markdown
Owner

Nothing changes for a sketch but what it cannot do by mistake: a Matrix or a Batch can no longer be moved or made without its arguments, which did not work before either. Whoever runs the simulator's tests or several web hosts in one program finds the port of a host that is gone free again. Every example has the same flash and RAM as on main.

The review of the chapter Classes of the coding style in OIL item 41, for the library and the host code, its rules that review checks:

  • C-2, the order in a class: every class but those of src/Utility/ began with its private members. All are in the order the rule asks now: public, protected, private, and in each types and constants, constructors and destructor, functions, data members. The text is moved, not changed, which a count of the lines added and removed confirms, and data members keep their order among themselves, as they are initialized in it. This commit is the bulk of the diff and is best read on its own.
  • C-3, the rule of six: the simulator's web host held its sockets without a destructor, so that its port stayed taken until the program ended; it closes them now, which a new test checks and which failed before. Six classes that deleted their copies now delete their moves as well, and Matrix and Batch their default constructor.
  • C-6 and C-8: the virtual functions of the control program's port give a reason the rule takes, rather than that a test replaces the port; MatrixOf and the control program's windows say why they derive.

Nothing to change for C-11, as nothing is mutable, nor for C-13, as the operators are the bitwise ones of Byte and the comparisons of Status and Result.

Checked:

  • make check passes: lint, clang-tidy, every host and AVR test, coverage at 100 % of lines, branches and conditions.
  • The control program's window builds; it was not clicked through, and its Windows half was not compiled, as there is no MinGW in the dev container.
  • Not run on hardware; nothing on the wire changes.

SimulatorWebHost closed none of its sockets when it was destroyed, so
its port stayed taken until the program ended; it has a destructor now,
which SimulatorWebHostTest checks, and fails without (C-3). A class that
declares a special member declares all six: the moves are deleted where
the copies were, and Matrix and Batch delete their default constructor
(C-3). The virtual functions of ControlPort give a reason C-6 takes, not
a test's; MatrixOf and the control program's windows say why they derive
(C-8).
public, protected, private, and in each: types and constants,
constructors and destructor, functions, data members. Every class but
the few that had it already began with its private members. The text
is moved, not changed; data members keep their order among themselves,
as they are initialized in it.
@theAndreas
theAndreas merged commit 00c2800 into main Nov 17, 2026
12 checks passed
@theAndreas
theAndreas deleted the oil-41-classes branch November 17, 2026 16:25
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