question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code always evaluates to true during root updating

See original GitHub issue

Unless I’m missing something, this line of code always evaluate to true:

https://github.com/tskit-dev/tskit/blob/5ad17dd604f02858701f453db523f5c455733523/c/tskit/trees.c#L1920

The reason is that there’s a logical-or comparison to above_sample[c], which has already evaluated to true.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
molpopgencommented, Feb 27, 2019

I had deleted that comment. It is wrong. The loop executed once the vast majority of the time, but not always.

On Wed, Feb 27, 2019, 1:26 AM Jerome Kelleher notifications@github.com wrote:

Important note from @molpopgen https://github.com/molpopgen (which doesn’t seem to have shown up here):

One corollary: the loop in question never does more than one iteration, and can therefore be eliminated entirely.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tskit-dev/tskit/issues/133#issuecomment-467788405, or mute the thread https://github.com/notifications/unsubscribe-auth/AGHnH8uLR9CjEJUa8YlgeLycFORYW1JSks5vRk8tgaJpZM4bRPLq .

0reactions
jeromekellehercommented, Feb 27, 2019

Important note from @molpopgen (which doesn’t seem to have shown up here):

One corollary: the loop in question never does more than one iteration, and can therefore be eliminated entirely.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does "a == x or y or z" always evaluate to True? How can ...
Since at least one of "John" and "Inbar" is not an empty string, the whole expression always returns True! The solution: a =...
Read more >
AP Computer Science A Final Exam Review Flashcards - Quizlet
Each variable was assigned true if the answer was correct and false if the answer was incorrect. Which of the following code segments...
Read more >
Code Inspection: Expression is always 'true' or always 'false'
This inspection is fairly obvious: ReSharper analyzes values and nullability, integer arithmetics, and so on, and suggests eliminating expressions that are  ...
Read more >
This condition will always return 'false' since the types have no ...
While the error claims "This condition will always return 'false'" it in fact evaluates to true. This is incredibly misleading. Playground Link ...
Read more >
Types of SQL Injection Attacks
Tautologies : An attacker injects queries that always evaluates to true to the Grade Central site to bypass authentication and retrieve grades. Retrieving...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found