I'm proposing a change to a library whose public API currently looks like this:
typedef size_t enh; /* handle */
int en_open(enh *handle)
{
struct internal *e = malloc(...);
*handle = (enh)e;
return 0;
}
int en_start(enh handle)
{
struct internal *e = (struct internal*)handle;
return do_something(e);
}
Does this usage, casting back and forth to size_t
break strict aliasing?
For the record, I'm proposing a typical opaque forward declaration of struct internal
in the public API, as shown on this Programmers.SE question about the same code.