I'm writing code for a flash driver and I sometimes have to check whether or not certain locations are empty i.e. contain 0xff.

Sometimes I check bytes, sometimes longer values. So I wanted to have a define that captures a type-less string of 1-bits that I can use to compare against.

It should work for signed and unsigned variables of 8, 16 and 32 bit wide.

I've tried the following two:

```
#define ERASED (-1)
#define ERASED (~0)

```

If I then compile the following code (all unsigned variables):

```
if (some32bitvar == ERASED)
{
    ....
}

if (some16bitvar == ERASED)
{
    ....
}

if (some8bitvar == ERASED)
{
    ....
}

```

The compiler is happy with the 16 and 32 bits variables, but complains about the 8 bit variable:

```
[Warning(ccom)] this comparison is always true 

```

Note: The architecture and compiler are 16-bit, so an int is 16 bit.

The compiler is correct because it extends `some8bitvar` to an `int`, which yields `0x00nn`. It then compares it against `ERASED` which is also extended to an `int` and thus yields `0xffff`.

A trivial solution is to use:

```
if (~some8bitvar)
{
    ....
}

```

But that uses implicit knowledge of an erased flash, which I want to abstract out and it obscures what the statement does.

Another solution is to use:

```
if (some8bitvar == (typeof(some8bitvar)) ERASED)
{
    ....
}

```

But that makes the code less clear and my compiler doesn't support the `typeof` macro. 

How can I define `ERASED` to make comparing to it work for all types?