News for hackers. Stuff that matters.
Re:Weekend projects: getting silly with C by frou_dh on Sunday June 30, 2024 @07:05AM (#40836505)
> for example I knew a guy that’d auto reject C PR’s if they didn’t use the syntax if (1==x) rather than if (x==1). The former will not compile if you accidentally use variable assignment instead of equality operator

I've seen that one and personally dislike that mindset: Making the code less readable to compensate for a disinterest in using actual static analysis tooling.

Re:Weekend projects: getting silly with C by tuveson on Sunday June 30, 2024 @11:06AM (#40837570)
These days GCC and Clang will both give you warnings for this if you have -Wall, which everyone should.
Re:Weekend projects: getting silly with C by kubanczyk on Monday July 01, 2024 @06:14PM (#40851379)
Less readable? I agree these are less readable:

  if (987654321987654321==x)

  if (find_optimal(frobnicator(x)*8)==1)
while these are subjectively more readable:

if (x==987654321987654321)

  if (1==find_optimal(frobnicator(x)*8))