I think adding a #define to define register to nothings makes sense.
If this is something that is tied to a specific C++ version, then it could be further qualified with a version value.
Mike
From: devel@edk2.groups.io <devel@edk2.groups.io>
On Behalf Of pawel.karczewski via groups.io
Sent: Friday, February 16, 2024 2:00 AM
To: devel@edk2.groups.io
Subject: [edk2-devel] Using ekd2-libc with C++20
Hi,
I'm successfully building C++20 project with edk2 under the GCC compiler.
Currently I'm trying to add edk2-libc to this project, but encountered issue with <string.h> header.
```
edk2/StdLib/Include/string.h:487:19: error: ISO C++17 does not allow ‘register’ storage class specifier [-Werror=register] register char **stringp
```
Why `strsep(register char **stringp, register const char *delim)` parameters has register storage class-class specifier?
C standard states the `register` keyword is only hint for the compiler and the extent to which such
suggestions are effective is implementation-defined. Do you see any real performance improvements thanks to this?
As I can see FreeBSD libc and musl do not have `register` keyword in signature of this function.
How do you think, may we remove `register` keyword from headers in Include directory?
Second option I see is to add
```
#ifdef __cplusplus
#define register
#endif
```
Of course I may submit patch for this change.
Paweł