Re: C ethics question



Servé Laurijssen said:

Recently, I found myself in the following situation:

There is library software written in C which declares some externals
like:

struct METER m1;
struct METER m2;

[...]

static void OnChangemeter(struct METER *m)
{
if (m == &m1) ...
if (m == &m2) ...
}

Now the comparison of these pointers is UB in C

Why?

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
.