Skip to content

Some pedantry: add const keywords where appropriate #49

Description

@tuurep

I have a habit of not using const which is probably not great, see for example:

https://www.reddit.com/r/C_Programming/comments/bg3bdq/comment/eli19si/

There's a concept called "const correctness" that basically means that variables should be declared "read only" (const, or constant) if they are indeed read-only. It's basically an additional type in the typing system, which lets the code and compiler help you make optimally-correct programs.

It can be a good exercise to go back to your code and find out where you can add const and where you can't.

Best to go through the whole code looking for these.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions