Re: C ethics question




"CBFalconer" <cbfalconer@xxxxxxxxx> wrote in message
news:460E5BE5.A78752A6@xxxxxxxxxxxx
"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.

Thanks for clearing that up, funny thing is I thought this was the case
because somebody in this group said this. I thought usenet was always
correct :(
Shame I cant find that post on google



--
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



.



Relevant Pages

  • Re: C ethics question
    ... static void OnChangemeter(struct METER *m) ... Now the comparison of these pointers is UB in C but in this case ... Those are equality tests, not relative tests. ...
    (comp.lang.c)
  • Re: Question on Q of toroid coil
    ... Huh. ... A Q meter. ... Posted via a free Usenet account from http://www.teranews.com ... Some of the resistors ...
    (sci.electronics.design)
  • Re: LIFESCAN Software
    ... the USB data cable for an Ultra II meter? ... Drugstore.com in the U.S. or a competitor. ... Posted via a free Usenet account from http://www.teranews.com ...
    (misc.health.diabetes)
  • Re: Question on Q of toroid coil
    ... Huh. ... A Q meter. ... This one is a nice design but needs an external signal generator. ... Posted via a free Usenet account from http://www.teranews.com ...
    (sci.electronics.design)
  • Re: Why pointers??
    ... onkar wrote: ... Why use pointers at all?? ... Some informative links: ... Posted via a free Usenet account from http://www.teranews.com ...
    (comp.lang.c)