Является ли использование memcmp для массива int строго соответствующим?

Является ли следующая программа строго соответствующей программе на C? Я заинтересован в C90 и C99, но ответы C11 также приемлемы.

#include <stdio.h>
#include <string.h>

struct S { int array[2]; };

int main () {
    struct S a = { { 1, 2 } };
    struct S b;
    b = a;
    if (memcmp(b.array, a.array, sizeof(b.array)) == 0) {
        puts("ok");
    }
    return 0;
}

Вкомментарии к моему ответу в другом вопросеЭрик Постпишил настаивает на том, что вывод программы будет меняться в зависимости от платформы, в первую очередь из-за возможности неинициализированных битов заполнения. Я думал, что присвоение структуры перезапишет все биты вb быть таким же, как вa, Но C99, похоже, не дает такой гарантии. Из раздела 6.5.16.1 р2:

In simple assignment (=), the value of the right operand is converted to the type of the assignment expression and replaces the value stored in the object designated by the left operand.

Что подразумевается под «преобразованным» и "заменяет" в контексте составных типов?

Наконец, рассмотрим ту же программу, за исключением того, что определенияa а такжеb сделаны глобальными. Было быthat Программа будет строго соответствовать программе?

Edit: Я просто хотел суммировать некоторые материалы для обсуждения здесь, а не добавлять свой собственный ответ, так как у меня действительно нет одного из моих собственных творений.

The program is not strictly conforming. Since the assignment is by value and not by representation, b.array may or may not contain bits set differently from a.array. a doesn't need to be converted since it is the same type as b, but the replacement is by value, and done member by member. Even if the definitions in a and b are made global, post assignment, b.array may or may not contain bits set differently from a.array. (There was little discussion about the padding bytes in b, but the posted question was not about structure comparison. c99 lacks a mention of how padding is initialized in static storage, but c11 explicitly states it is zero initialized.) On a side note, there is agreement that the memcmp is well defined if b was initialized with memcpy from a.

Спасибо всем, кто принимал участие в обсуждении.

Ответы на вопрос(2)

Ваш ответ на вопрос