jk-jeon / fp

IEEE-754 binary-to-decimal and decimal-to-binary conversion library
40 stars 5 forks source link

Uninitialised Variables #8

Open sirinath opened 3 years ago

sirinath commented 3 years ago

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

jk-jeon commented 3 years ago

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

sirinath commented 3 years ago

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

jk-jeon commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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.