[With Bounty] please help me with random code behavior

I forked a project on Github and try to make some changes as a learning experience. And I'm running into a weird thing and I'm having trouble figuring this out:

https://github.com/buhrmi/stellar-core/blob/master/src/ledger/AccountFrame.cpp#L376

Even though the variable isnew is a boolean and only ever set to true/false or 1/0 in the code, it sometimes has funny values like "46" or "894334" ... Can you guys help me figure out what's wrong here?

BTW: I set up a bounty of $50 for some help. You can post your answer here. https://bountify.co/find-source-of-random-behavior-in-c-code
Sorry to disagree, but I don't think the "funny values" coming from isnew. What makes you think it is ? The only reason you would see a non 0 or 1 in a bool is if the variable was uninitialized and you haven't assigned it a value in the code.
Last edited on
Samuel is probably right. It looks like you only initialize isnew in one of the constructors.
I posted my suggestion where you asked. If that doesn't fix it, maybe post some output showing code execution and these funny values.
SamuelAdams .. Thanks, that was correct. The constructers that left the variable unitialized were to blame. I've awarded the bounty to you.
Just wanted to let you know that it says you awarded the bounty to someone else.

Yikes! Sorry for the mix-up.
If you send feedback to Bountify, maybe they can fix it.
On their website, it appears it's sent to paypal within 48 hours, so you may still have time.
I would really appreciate it.

https://bountify.co/contact

Thx

Sam
Last edited on
Having a discussion going on at two places at the same time is confusing, especially when the same persons take part under different names.

Samuel, I think he gave it to the right person. To me it looks like the best answer. The mix-up was probably that he though you were that person.
Last edited on
I agree all the answers were on the right track, although I pointed to the line of code and suggested the solution. I was typing a reply here when I guess I should have been using the other site and the other guy got his post in just before mine. I'm just disappointed since that's the first time I ever had a chance to win/earn a reward for coding.

It's all good, it's actually not worth the effort to try and get it fixed probably. I enjoyed the challenge and that's what's important.
Topic archived. No new replies allowed.