samedi 15 juillet 2017

C++14 uniform initialization on structs

I've got the following fairly simple code:

    WNDCLASSEX windowClass = {0};

    windowClass.cbSize { sizeof(WNDCLASSEX) };

I would like to know why the above code does not work and the code below does:

    WNDCLASSEX windowClass = {0};

    windowClass.cbSize = { sizeof(WNDCLASSEX) };

Visual Studio 15 2017 gives me those two errors:

1: expected a ';'

2: error C2064: term does not evaluate to a function taking 1 arguments

Aucun commentaire:

Enregistrer un commentaire