Skip to content

CODE-QUALITY: Assignment in if condition - commands.c:1295 #5

@smooge

Description

@smooge

Bug Type

CODE-QUALITY - Assignment in conditional expression

Severity

Low

Phase Discovered

Phase 4: Warning Elimination - commands.c modernization

Files Affected

  • commands.c:1295

Description

Line 1295 uses assignment within if condition: if((armynum=getselunit())>=0)
This relies on side effects and reduces code readability.

Code Location

commands.c:1295

Impact Assessment

  • No functional impact - code works correctly
  • Readability concern - assignment mixed with condition test
  • Maintenance risk - harder to debug and understand

Recommended Resolution

Separate assignment from conditional test:

// Current (problematic):
if((armynum=getselunit())>=0) {

// Recommended:
armynum = getselunit();
if(armynum >= 0) {

Session History

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions