[sprintf] Support for 16-bit int systems
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 45/100
Research direction
The size assumptions are in stb_sprintf.h, and the issue points to the length-modifier checks around lines 543-555, where 'z' tests for ptrdiff_t instead of size_t and 'j' tests for size_t instead of intmax_t. Start there and find where sizeof(int) == 4 is assumed. Done means the modifier checks match the C types they name and the int width is taken from the platform, with the change compiling for a 16-bit int target.
Written by the indexing model from the issue text.
Description
The library makes various assumptions about the size of primitive types.
In particular, it assumes that sizeof(int) == 4.
It would be nice to be more standard and respect the actual int size of the system, as well as have better checks for the proper size to use for the 'j' 'z' 't'.
'z' now checks for the wrong type -- prdiff_t rather than size_t; and 'j' checks for 'size_t' rather than 'intmax_t', in order to avoid including more standard headers:
https://github.com/nothings/stb/blob/f0569113c93ad095470c54bf34a17b36646bbbb5/stb_sprintf.h#L543-L555
- Dominant language
- C
- Stars
- 18
- Forks
- 5
- Avg merge
- 1m
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nothings/stb_sprintf
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
nothings/stb_sprintf#10 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
nothings/stb_sprintf#8 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nothings/stb_sprintf#5 ·
-
[SECURITY] stbsp_snprintf with count=0 writes null terminator before bufferPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nothings/stb_sprintf#4 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
nothings/stb_sprintf#20 ·
All issues in nothings/stb_sprintf
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 5 days
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
bug severity: medium
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AlessandroSangiuliano/Uros#1014 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
OpenXiangShan/NEMU#1314 ·
Maintainers usually reply within 1 day