Keith Thompson <
Keith.S.Thompson+u@gmail.com> writes:
Michael S <already5chosen@yahoo.com> writes:
On Mon, 04 Aug 2025 12:09:32 GMT
anton@mips.complang.tuwien.ac.at (Anton Ertl) wrote:
[...]
typedef ump unsigned _BitInt(65535);
The correct syntax is :
typedef unsigned _BitInt(65535) ump;
ump sum3(ump a, ump b, ump c)
{
return a+b+c;
}
[...]
1. Both gcc and clang happily* accept _BitInt() syntax even when
-std=c17 or lower. Is not here a potential name clash for existing
sources that use _BitInt() as a name of the function? I should think
more about it.
In C17 and earlier, _BitInt is a reserved identifier. Any attempt to
use it has undefined behavior. [...]
Not so. The C standard says if a program declares or defines a
reserved identifier (in a context where it is reserved) then the
behavior is undefined. The C standard does /not/ say that simply
using (as opposed to declaring or defining) a reserved identifier
has undefined behavior (in any context).
The C23 standard is different, but I believe what it says is
consistent with the previous paragraph.
Furthermore it is always possible to use any reserved identifier
in a way that has defined behavior, as for example:
#include <stdio.h>
#define XX(a) X(a)
#define X(a) #a
#define show(a) printf( "The id %s expands to %s\n", X(a), XX(a) )
int
main( int argc, char *argv[] ){
show( _BitInt );
return 0;
}
This program works without complaint under all of C90, C99, C11, and
C17.
--- PyGate Linux v1.5.2
* Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)