По сути, был вопрос про где чёрным по белому написано. Вот цитата из хелпа к IAR for stm8:
Цитата
Casting
Casts between pointers have these characteristics:
* Casting a value of an integer type to a pointer of a smaller type is performed by truncation
* Casting a value of an integer type to a pointer of a larger type is performed by zero extension
* Casting a pointer type to a smaller integer type is performed by truncation
* Casting a pointer type to a larger integer type is performed by zero extension
* Casting a data pointer to a function pointer and vice versa is illegal
* Casting a function pointer to an integer type gives an undefined result
* Casting from a smaller pointer to a larger pointer is performed by zero extension
* Casting from a larger pointer to a smaller pointer is performed by truncation.
* Casting _ _eeprom to another data pointer and vice versa is illegal
Casts between pointers have these characteristics:
* Casting a value of an integer type to a pointer of a smaller type is performed by truncation
* Casting a value of an integer type to a pointer of a larger type is performed by zero extension
* Casting a pointer type to a smaller integer type is performed by truncation
* Casting a pointer type to a larger integer type is performed by zero extension
* Casting a data pointer to a function pointer and vice versa is illegal
* Casting a function pointer to an integer type gives an undefined result
* Casting from a smaller pointer to a larger pointer is performed by zero extension
* Casting from a larger pointer to a smaller pointer is performed by truncation.
* Casting _ _eeprom to another data pointer and vice versa is illegal
Почему сам не писал сравнение и ковыряние в ЕЕПРОМ: да всё просто - раньше я так и делал, так у меня было сделано в предыдущих проектах, а теперь хотел воспользоватся стандартными инструментами С и IAR, но пока не получилось.
Вообще, мне кажется на STM проще всего писать на АСМ, т.к. сравниваю код, что генерит компилятор и код, что напишу я в этом случае на ассемблере - раза в 1,5 более эффективно получается (иногда 10%, иногда в 2 раза и больше).
Просто хотелось освоить именно чистый С... В) С# - писал, ASM - писал, С - не писал. В)
Сейчас попробую с приведением типа, будет ли работать.
Всё заработало в таком виде:
Код
if (memcmp((void*)ee_key_list[0], mf_key_list[i], sizeof(mf_key_list[0]) == 0))
Тогда не понял, а что в доках написано:
* Casting _ _eeprom to another data pointer and vice versa is illegal
И ещё раз не понял: если на входе процедуры указатель на безтиповый массив (фактически - на первый байт массива), плюс длина этого массива, используется побайтовое сравнение (а не поэлементное, т.к. в любом случае кастится к void, как я понял?? - прав ли я?), тогда почему бы автоматически любой массив не кастить к войду? Чего компилятор не понимает? Какое может быть другое поведение, кроме сравнения побайтно двух областей памяти начиная с двух указателей?