Skip to content

Conversation

@wdfk-prog
Copy link

Title

Fix type limit warning in linenoiseEditFeed on ARM builds

Description

I encountered a compilation warning when cross-compiling for AArch64 (ARMv8) using GCC with -Wextra enabled:

warning: comparison is always false due to limited range of data type [-Wtype-limits]
if (c < 0) return NULL;

Reason:
On ARM platforms, the char type is unsigned by default (0 to 255). Therefore, the check c < 0 never evaluates to true, effectively ignoring error codes returned by completeLine().

Fix:
Explicitly cast c to (signed char) in the conditional check. This ensures that negative return values are correctly identified regardless of the platform's default char signedness.

Verification

  • Verified that the warning disappears after the fix on AArch64 cross-compilation.
  • Verified that the code still compiles correctly on x86 environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant