Alexandre Julliard wrote:
Ivan Gyurdiev <[EMAIL PROTECTED]> writes:
It's already marked const in the parameters of the set and get
functions, which means it can't be modified there (arg 3):
+ void (*set_handler) (IDirect3DDevice9* device, const struct
state_test* test, const void* data_in);
+ void (*get_handler) (IDirect3DDevice9* device, const struct
state_test* test, const void* data_out);
Which is precisely why the data pointers have to be const too. Since
the tests don't modify anything,
Well... the way I see it, the test is composed of get/set, while the
init/teardown is just setup for the test, which may or may not include
allocating the data pointers on the heap (and correspondingly freeing
that data). Therefore the data is const in one place, and non-const in
the other where I don't know what the test is going to do (by virtue of
polymorphism). Yes, I suppose you could look at that as two completely
separate usages of the same data, requiring separate pointers, but that
seems rather odd to me.
Actually the other direction is possible too, keeping the data const,
and just casting off the const in the teardown function, but that seemed
uglier.
it must be possible to give them
constant data. With your scheme you need to cast const off, which is
ugly and will cause compiler warnings.
I don't know about ugly, but the casts actually prevent warnings,
instead of causing them...
Is there a compiler flag that you use to cause warnings? If so, please
let me know what it is, and I'll fix the code.