[sprintf] Use 'restrict' pointers ?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 55/100
Direzione di ricerca
The change touches the public vsprintf, vsnprintf, sprintf, snprintf and vsprintfcb declarations in the single header stb_sprintf.h, plus a STBSP__RESTRICT macro that would be defined conditionally on __STDC_VERSION__. Start by reading those declarations and checking how the header is compiled in its own test or build setup. Done means the signatures carry the qualifier under C99 and compile unchanged elsewhere; the thread has no maintainer decision yet, so confirm the direction before editing.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
In the standard printf functions, the output buffer and the format string are declared as 'restrict' pointers (char restrict, const char* restrict).
This was introduced in C99, at least according to https://en.cppreference.com/w/c/io/fprintf
It does not exist in C++
The function signatures could be changed in this way:
STBSP__PUBLICDEC int STB_SPRINTF_DECORATE(vsprintf)(char * STBSP__RESTRICT buf, char const * STBSP__RESTRICT fmt, va_list va);
STBSP__PUBLICDEC int STB_SPRINTF_DECORATE(vsnprintf)(char * STBSP__RESTRICT buf, int count, char const * STBSP__RESTRICT fmt, va_list va);
STBSP__PUBLICDEC int STB_SPRINTF_DECORATE(sprintf)(char * STBSP__RESTRICT buf, char const * STBSP__RESTRICT fmt, ...) STBSP__ATTRIBUTE_FORMAT(2,3);
STBSP__PUBLICDEC int STB_SPRINTF_DECORATE(snprintf)(char * STBSP__RESTRICT buf, int count, char const * STBSP__RESTRICT fmt, ...) STBSP__ATTRIBUTE_FORMAT(3,4);
STBSP__PUBLICDEC int STB_SPRINTF_DECORATE(vsprintfcb)(STBSP_SPRINTFCB *callback, void *user, char * STBSP__RESTRICT buf, char const * STBSP__RESTRICT fmt, va_list va);
with:
#if defined(__STDC_VERSION__) && (__STDC_VERSION__) >= 199901L
#define STBSP__RESTRICT restrict
#else
#define STBSP__RESTRICT
#endif
Restrict pointers might help the compiler optimize access to those arrays.
- Lingua principale
- C
- Stelle
- 18
- Fork
- 5
- Merge medio
- 1m
- PR unite (30g)
- 3
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nothings/stb_sprintf
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
nothings/stb_sprintf#10 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
nothings/stb_sprintf#8 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
nothings/stb_sprintf#5 ·
-
[SECURITY] stbsp_snprintf with count=0 writes null terminator before bufferForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
nothings/stb_sprintf#4 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
nothings/stb_sprintf#20 ·
Tutte le issue di nothings/stb_sprintf
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
CachyOS/kernel-patches#197 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
kovidgoyal/kitty#10976 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] cuDSS 1.0 rejects libcudss_mtlayer_cuopt.so (status = 3): missing cudssThreadingGetPropertyAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug no-disc-needed
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Jstar269/nakagawa-recomp#3421 ·
I maintainer di solito rispondono entro 1 giorno