Skip to content

Make section start "nullable" (represented by std::nullopt) - #45

Open
antis81 wants to merge 3 commits into
sasq64:devfrom
antis81:optional-section-args
Open

Make section start "nullable" (represented by std::nullopt)#45
antis81 wants to merge 3 commits into
sasq64:devfrom
antis81:optional-section-args

Conversation

@antis81

@antis81 antis81 commented Jul 24, 2023

Copy link
Copy Markdown
Contributor

The basic idea is to enable bass's SymbolTable to interpret nullopt (aka "undefined", "None" or "nil") for typed arguments.
Currently such state does not exist (which in worst case can result in output holding "false positive" bytes - e.g. 0xff sometimes means -1 and sometimes it should error out instead - ⚡)

Addressing section "start", "pc" and "size" as a starting point.

To keep changes reviewable the logical behaviour of the assembler does not change here (at least not yet). What changes is only the comparison section.start == -1 vs !section.start.has_value() (alternatively section.start == std::nullopt).

antis81 added 3 commits July 24, 2023 16:04
…onal

Those will be serialized into the symbol table and
can now hold an additional "nullopt" (-> None) status.
However those values are still initialized with a -1 value
and behave as if they were an "int".

Means:
None of section start/pc/size will run into an "undefined" status.
Note that whenever we use section start as an algorithmic value
it has to be a "raw" int(!)

FYI:
Section start will still hold an int-value. The "else" in
Machine::layoutSections() will not take effect because
Check(section.start.has_value(), "Section must have start");
@antis81 antis81 changed the title Make section arguments "nullable" (represented by std::nullopt) Make section start "nullable" (represented by std::nullopt) Jul 25, 2023
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.

1 participant