Attention is currently required from: Anastasia Klimchuk.
2 comments:
File tests/io_mock.h:
Patch Set #3, Line 34: /* Define libusb symbols to avoid dependency on libusb.h */
Now that I realized that we don't mock `libusb.h` for the code under
test. I wonder why we should avoid it here? It doesn't hurt so I'm
ok with it. Just wondering.
(I guess it wouldn't be hard to build the tests without libusb,
but that can still be done if anyone ever needs it.)
File tests/io_mock.h:
Done, it works! but I'm not sure I understand how it works... […]
Oh, I missed earlier that you avoid the libusb dependency here while
it's still needed for the tests to build (includes of the code under
test). There are some explanations why this works. Here is why this
is legal in C:
(NB. Incomplete types are a means of information hiding in C.)
Here is my favorite explanation: It all doesn't matter ;) because the
compiler only looks at compilation units individually. And the linker
who stitches the compilation results of the various compilation units
together doesn't know C and its types. It doesn't even have to know
parameters. There's a call to a symbol, it replaces the symbol with
an address. That's about it. To get a working program out of it, the
compiler needs to know the size of the parameters, and the size needs
to match across compilation units. All pointers have the same size in
C which makes it work even if we'd use `int *` here.
To view, visit change 55934. To unsubscribe, or for help writing mail filters, visit settings.