Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

[boost.c] is ill-formed (no diagnosis required): The Standard reserves function names beginning with ‘str’ or ‘mem’ for possible future use. #36

Open
ViralTaco opened this issue May 23, 2021 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers wontfix This will not be worked on

Comments

@ViralTaco
Copy link

Hi,

Issue:

size_t strlen_cacher(char* str)

The name strlen_cached is reserved by the standard.

cf: ISO/IEC 9899:201x

  • §7.1.3 Reserved identifiers p182
  • §7.31.12 General utilities <stdlib.h> p456
  • §7.31.13 String handling <string.h> p456

NB: Also reserved are… Well, there's a fat list, really.
Here is the most useful link you'll ever get for fast reference to the C and C++ Standards and libraries:
cppreference.com C Reserved Identifiers

Current Behavior:

Undefined. Any, or none.

Expected Behavior:

The behavior of an identical function given a valid, unreserved, name.

Proposed Solution:

Change the name of the function. eg: cached_strlen

@mempler
Copy link

mempler commented Aug 11, 2021

If you read it again, it's called strlen_cacher and not strlen_cached

@tostercx
Copy link
Owner

Yeah, apparently anything starting with str followed by a lowercase letter is reserved for future use, so this would still apply. Had no idea,

@tostercx tostercx added good first issue Good for newcomers bug Something isn't working wontfix This will not be worked on labels Aug 11, 2021
@mempler
Copy link

mempler commented Aug 12, 2021

Lets just simply call it Superduperwhoopsboopsnonstdcompliant_strlen_cacher 😄 Jokes aside, truly a good first issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working good first issue Good for newcomers wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants