Re: C ethics question



"Servé Laurijssen" wrote:

.... snip ...

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

Now the comparison of these pointers is UB in C but in this case
it's the only way to do it. What would you do in such a situation
when you work on a project that has to be finished shortly?

No, it's not UB. Those are equality tests, not relative tests.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>



--
Posted via a free Usenet account from http://www.teranews.com

.