Skip to content

[cstdlib.syn] Add missing index entries and remove stray entries - #9309

Merged
jensmaurer merged 1 commit into
cplusplus:mainfrom
eisenwave:cstdlib-syn-reindex
Sep 4, 2026
Merged

[cstdlib.syn] Add missing index entries and remove stray entries#9309
jensmaurer merged 1 commit into
cplusplus:mainfrom
eisenwave:cstdlib-syn-reindex

Conversation

@eisenwave

Copy link
Copy Markdown
Member

The indexing in [cstdlib.syn] is really broken in a number of ways:

  • Several symbols are not indexed anywhere, especially the more recent C23 stuff. For example, there is no index entry for memalignment, free_sized, strfromf, etc. I haven't counted, but there should be at least a dozen missing entries here.
  • Several index entries point to declarations, not to definitions, by virtue of having dedicated subclauses with definitions. For example, there are index entries for rand and srand, even though those are defined in [c.math.rand]. Traditionally, we do not index declarations.
  • The synopsis spans at least two pages, so some of the index entries point to the wrong page.
  • The big pile of \indexlibrayglobal makes it difficult to maintain the indexing in this area. Inline \libglobal is better.

@eisenwave eisenwave added the P2-Bug Presentational errors and omissions label Sep 4, 2026
Comment thread source/support.tex
\indexlibraryglobal{mbstowcs}%
\indexlibraryglobal{mbtowc}%
\indexlibraryglobal{qsort}%
\indexlibraryglobal{quick_exit}%

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We removed this here, but didn't add \libglobal below, it seems.

@eisenwave eisenwave Sep 4, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentional for all of the comments that you've left. All of the functions that have not received \libglobal formatting are defined in some other place, such as https://eel.is/c++draft/c.mb.wcs#lib:mbstowcs

We don't usually add an index entry for forward declarations, and https://eel.is/c++draft/cstdlib.syn#1 explicitly exempts the functions defined in those other subclauses from receiving the "this does the same thing as in C" treatment.

I think indexing mbstowcs in this place would be outright misleading because it would incorrectly imply that the function is defined in [cstdlib.syn] with "this does the C thing" treatment.

Comment thread source/support.tex
Comment on lines 140 to 141
void* aligned_alloc(size_t alignment, size_t size);
void* calloc(size_t nmemb, size_t size);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about these? No index entries?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread source/support.tex
Comment on lines 145 to 146
void* malloc(size_t size);
void* realloc(void* ptr, size_t size);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here? No index entries?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread source/support.tex
unsigned long long int @\libglobal{strtoull}@(const char* nptr, char** endptr, int base);

// \ref{c.mb.wcs}, multibyte / wide string and character conversion functions
int mblen(const char* s, size_t n);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of these: no index entries?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread source/support.tex
constexpr div_t div(int numer, int denom); // freestanding
constexpr div_t @\libglobal{div}@(int numer, int denom); // freestanding
constexpr ldiv_t div(long int numer, long int denom); // freestanding; see \ref{library.c}
constexpr lldiv_t div(long long int numer, long long int denom); // freestanding; see \ref{library.c}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we normally put libglobal on every member of an overload set. I think that would generate multiple quasi-identical index entries.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Index entries pointing to the same page are automatically merged by the indexing machinery.

@jensmaurer
jensmaurer merged commit 51de607 into cplusplus:main Sep 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2-Bug Presentational errors and omissions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants