Skip to content

fixed for windows compiler warnings#70

Merged
topepo merged 1 commit into
mainfrom
windows-compiler-warnings
Feb 27, 2026
Merged

fixed for windows compiler warnings#70
topepo merged 1 commit into
mainfrom
windows-compiler-warnings

Conversation

@topepo
Copy link
Copy Markdown
Owner

@topepo topepo commented Feb 27, 2026

Building the package on Windows with GCC 14.3.0 produced several compiler warnings:

  • Uninitialized variable warnings (-Wmaybe-uninitialized): Variables that could potentially be used before being assigned a value
  • Integer-to-pointer cast warning (-Wint-to-pointer-cast): Casting from long to pointer on platforms where they have different sizes (32-bit vs 64-bit)
  • Operator precedence warning (-Wparentheses): Missing parentheses around && within || expression
  • Unused variable warning (-Wunused-variable): Declared but never used variable

Changes

File Line Warning Fix
src/contin.c 54 BestI may be uninitialized Initialized to 0
src/getnames.c 333 cast to pointer from integer of different size Changed (long)v + 1 to (intptr_t)(v + 1) for portable pointer-sized integer
src/modelfiles.c 325 Att may be uninitialized Initialized to 0
src/defns.h 165 suggest parentheses around && within || Added parentheses to clarify operator precedence
src/rules.c 360 Last may be uninitialized Initialized to 0
src/rules.c 455 Outcome may be uninitialized Initialized to 0
src/sample.c 22 unused variable Option Removed from extern declaration
src/trees.c 249 Ll may be uninitialized Initialized to 0

Notes

  • The uninitialized variable warnings are false positives in the sense that the code logic ensures they are always assigned before use, but initializing them silences the warnings and is defensive coding practice
  • The intptr_t type from <stdint.h> is guaranteed to be the same size as a pointer on all platforms, making the cast portable

@topepo topepo marked this pull request as ready for review February 27, 2026 14:28
@topepo topepo merged commit b4adacc into main Feb 27, 2026
12 checks passed
@topepo topepo deleted the windows-compiler-warnings branch February 27, 2026 15:29
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