Common type of ubyte and const ubyte is int
Walter Bright
newshound2 at digitalmars.com
Fri May 3 19:40:36 UTC 2024
On 5/1/2024 7:42 AM, Steven Schveighoffer wrote:
> It seems rule 2 would apply instead of rule 6? but I don't like it.
```
#include <stdio.h>
void main()
{
char u;
const char v;
printf("%ld %ld\n", sizeof(u), sizeof(1?u:v));
}
```
This prints "1 4". D follows the same integral promotion rules, and the reason
is if one translates C code to D, one doesn't get an unpleasant hidden surprise.
More information about the Digitalmars-d
mailing list