Skip to content

Conversation

@BilawalAhmed0900
Copy link

@BilawalAhmed0900 BilawalAhmed0900 commented Sep 10, 2024

Fixed an issue when old cache number value is used when XString is set()

djberg96 added a commit to djberg96/xalan-c that referenced this pull request Dec 30, 2025
@djberg96
Copy link

djberg96 commented Dec 30, 2025

I threw AI at this, using your code originally. It came up with this instead: djberg96#2 instead.

Comments from AI:

The PR branch now uses a proper validity flag for the cached number value:

Added a mutable bool m_cachedNumberValid; to the header
All constructors initialize this flag to false
num() checks the flag instead of comparing against 0.0, computes and updates the value/flag as needed
ClearCachedNumber() simply sets the flag to false
The copy constructor preserves the flag's value
Your cache invalidation is now robust and correct for all possible numeric string cases!

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.

2 participants