forked from vejeta/conquer
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Bug Type
DOC-COMPATIBILITY - Portability problem with data structure sizing
Severity
Medium
Phase Discovered
Phase 4.4: Warning elimination - main.c modernization
Files Affected
- data.h:618 - struct s_nation definition
- main.c:498,501 - uid comparison operations requiring casts
Description
The struct s_nation uses 'short int uid' for storing user IDs, but modern Unix systems use uid_t (unsigned int, 32-bit). This creates both compilation warnings and potential data truncation issues.
Code Location
data.h:618
main.c:498,501 - Requires casts: (uid_t)curntn->uid
Impact Assessment
- Compilation: Sign-compare warnings between short int and uid_t
- Data Integrity: UIDs > 32767 would be truncated when stored in short
- Portability: Modern systems commonly have UIDs beyond short int range
- File Format: Changing struct affects saved game file compatibility
Recommended Resolution
- Immediate: Apply casts in main.c to eliminate warnings (current approach)
- Long-term: Modernize struct field to uid_t with migration strategy
- Migration: Implement file format versioning for backward compatibility
- Testing: Verify no saved game files use UIDs > 32767
Session History
- Phase 4.4 warning elimination session
- Applied temporary casts to resolve compilation warnings
- Identified structural modernization need for future phase
Metadata
Metadata
Assignees
Labels
No labels