Repository navigation
OIL 41, chapter Functions: host code returns its results - #126
Merged
Merged
Conversation
No function of the simulator, the control program or DocuPictures writes its result through a pointer any more. What one finds or reads it returns, with whether it did in a small struct of its own where both are needed; what the hosts receive they return, and the caller appends. A buffer that grows over many calls, an index the caller moves on, and an object a function draws on are references. SimulatorRun::SetUp() keeps its two, as it sets up the objects the tick reaches. The library and its sizes do not change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nothing changes for a sketch or for whoever uses the simulator or the control program. The library is untouched, and every example has the same flash and RAM as on main.
The third pull request of the review of the chapter Functions in OIL item 41, for FN-8 and FN-15 of the coding style, as decided on 2026-11-17: a result is returned, not written into a parameter, and a parameter that must exist is a reference, not a pointer. The host code wrote some 40 results through pointers, mostly a
boolbeside the value it found.std::optionalis C++17 and the host code is built asgnu++11.DocuPicturesdraws on are references.Checked:
make checkpasses: lint, clang-tidy, every host and AVR test, coverage at 100 % of lines, branches and conditions; the tests of the WebSocket, the hosts, the ports, the link and the commands call the new signatures.