Skip to content

Examine const-correctness #4

@zanebeckwith

Description

@zanebeckwith

Currently, most of the by-reference parameters in our functions, especially internal ones, are not const. Even when logically they definitely should be.

This is a bit of a sticky wicket, because AMCL's API doesn't use const, and many of those functions do have side-effects on their parameters, sometimes subtly so.

Further, taking our parameters as const then casting the const away can be dangerous, even when the source code appears to not modify the parameter, because the compiler may get too smart. For example, if the machine code from AMCL ends up doing something cute where the memory gets updated then changed back (allowed because the AMCL code took it as non-const), but that memory is actually ROM (because our code, which defined it, said it's const), we could fault.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions