[Ovmsdev] Working on ESP-IDF5 + Have a question about ovms_module 'Name'

Michael Geddes frog at bunyip.wheelycreek.net
Sun Jan 21 09:54:57 HKT 2024


Hey, In working trying to get ESP-IDF 5+ Working, I came across the
following fun thing that I'm trying to work out what is going on!!
This is from main/ovms_module.cpp
I'm not sure why we don't just go through all the words and compare - why
the masked compare for the last entry! And why that value?? It might make
sense if you masked out the final byte ... I'm just struggling to
understand.

Why am I looking at it?? Well there's a new warning about copy
constructors.. and then I ran into a problem where 'Name' is sometimes in
memory that can only be accessed 32bit int aligned (which is why the
strange implementation in the first place - I get that).

Can anybody shed any light on this?


class Name
  {.......
   inline bool operator==(const Name& a) const
      {
      for (int i = 0; i < NAMELEN/4 - 1; ++i)
        if (a.words[i] != words[i]) return false;
      i*f (a.words[NAMELEN/4-1] != (words[NAMELEN/4-1] &  0x7FFFFFFF))
return false;*
      return true;
      }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20240121/cd0b49b2/attachment.htm>


More information about the OvmsDev mailing list