Skip to content

Conversation

@alejandro-colomar
Copy link
Collaborator

@alejandro-colomar alejandro-colomar commented Jul 18, 2025


Revisions:

v1b
  • Rebase
$ git rd
1:  49e5b01a ! 1:  682e6ae8 lib/, src/: Reorder while() conditions for safety
    @@ Metadata
      ## Commit message ##
         lib/, src/: Reorder while() conditions for safety
     
    -    In conditions that check for NULL after assignment, it's safer to put
    -    the NULL check first, as a mistake would result in a compiler error,
    -    as opposed to unwanted implicit conversions.  It's also more readable.
    +    In conditions that perform simple assignment (=) before comparison,
    +    it's safer to put the comparison first, as a mistake would result in a
    +    compiler error, as opposed to assigning something incorrect.
    +    It's also more readable, IMO.
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     

@alejandro-colomar alejandro-colomar changed the title Readability fixes. While-loop readability improvements. Jul 18, 2025
@alejandro-colomar alejandro-colomar marked this pull request as draft July 18, 2025 13:05
@alejandro-colomar alejandro-colomar force-pushed the gcu branch 2 times, most recently from a3e58f4 to 49e5b01 Compare July 18, 2025 20:16
@alejandro-colomar alejandro-colomar marked this pull request as ready for review July 20, 2025 14:40
@alejandro-colomar alejandro-colomar added the Simpler A good issue for a new beginner label Jul 20, 2025
In conditions that perform simple assignment (=) before comparison,
it's safer to put the comparison first, as a mistake would result in a
compiler error, as opposed to assigning something incorrect.
It's also more readable, IMO.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
Copy link
Member

@hallyn hallyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're showing your prejudice against left-handed people :)

kidding.

@hallyn hallyn merged commit 2ff1690 into shadow-maint:master Aug 9, 2025
10 checks passed
@alejandro-colomar
Copy link
Collaborator Author

You're showing your prejudice against left-handed people :)

kidding.

:)

@alejandro-colomar alejandro-colomar deleted the gcu branch August 10, 2025 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Simpler A good issue for a new beginner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants