Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion to Modify “ARGNUM_TYPE” to UInt32 #16

Closed
wylin1212 opened this issue May 24, 2024 · 2 comments
Closed

Suggestion to Modify “ARGNUM_TYPE” to UInt32 #16

wylin1212 opened this issue May 24, 2024 · 2 comments

Comments

@wylin1212
Copy link

const ARGNUM_TYPE = UInt16

I noticed that in your code, the type ARGNUM_TYPE is defined as UInt16. However, I found that UInt16 may pose limitations, especially when dealing with large data.
For example:

using Scanf
str =repeat("%d%f",401000)
Scanf.Format(str)

Therefore, I would like to suggest considering modifying the type ARGNUM_TYPE to UInt32. The UInt32 type offers a wider range of values, which could enhance the robustness of the code and improve its ability to handle large datasets effectively.
Thank you for considering my suggestion. I look forward to hearing from you.

@wylin1212
Copy link
Author

@KlausC

@KlausC
Copy link
Owner

KlausC commented May 26, 2024

I tried the obvious change you are suggesting (const ARGNUM_TYPE = UInt32) and came to the conclusion, that this is not compatible with this implementation.
The size of the objects and types used internally is already prohibitively huge when the number of arguments approaches typemax(UInt16), so larger values simply make the implementation practically unusable.
I don't think it is worth the effort to reimplement the whole stuff for a extremely rare use case, the typical case being a few or maximally a few dozens of arguments to be used in one format.
BTW, in C or C++ implementations, there is an implicit limit of 127 or 255 due to the minimal requirement on the number of arguments of a function call, which have to be supported by conforming implementations of the language.

@KlausC KlausC closed this as completed May 26, 2024
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

No branches or pull requests

2 participants