Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninitialised Variables #8

Open
sirinath opened this issue Feb 1, 2021 · 5 comments
Open

Uninitialised Variables #8

sirinath opened this issue Feb 1, 2021 · 5 comments

Comments

@sirinath
Copy link

sirinath commented Feb 1, 2021

Following variables do not seam to be explicitly initialised: is_closed, is_left_closed in both policy.h files.

@jk-jeon
Copy link
Owner

jk-jeon commented Feb 1, 2021

What do you mean? They are initialized when the object is created.

@sirinath
Copy link
Author

sirinath commented Feb 1, 2021

I mean you can have a constructor to explicitly initialise the values.

@jk-jeon
Copy link
Owner

jk-jeon commented Feb 1, 2021

That sounds reasonable, but it also creates another set of problems.

I like the terseness of just writing return{ br.u % 2 != 0 } (b/c the names of these classes are horribly long), but at the same time do not want to make these classes to be implicitly convertible from bool.

Another alternative might be to use return-type deduction to reduce the number of times I have to write the class name.

But honestly, is it that big problem?

@sirinath
Copy link
Author

sirinath commented Feb 1, 2021

No. This is not a big problem but takes a while to understand. The problem is that one do no know if the fields get mutated some where else and if so where. Maybe they can be just made consts.

@jk-jeon
Copy link
Owner

jk-jeon commented Feb 1, 2021

Ah, const sounds reasonable, though it feels like having a const member variable (especially for (essentially) raw C-style structs like these) is a bit unconventional. I'll think of that.

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

No branches or pull requests

2 participants