The following is legal:
OCPersistentStorage ps = {
.open = client_fopen,
.read = fread,
.write = fwrite,
.close = fclose,
.unlink = unlink };
On Mon, 2015-08-03 at 21:55 +0000, Light, John J wrote:
> I?ve noticed a great increase in the number of warnings during build.
> There have been more warnings in recently merged code, but this
> lastest increase seems to be the result of ratcheting up the warning
> threshold.
>
>
>
> I suspect we are well into the territory where critical warnings won?t
> be seen because they will be lost in a sea of non-critical warnings.
>
>
>
> Leaving that aside, I have a coding question in this new regime.
>
>
>
> A C file I am modifying but didn?t write has the following code:
>
>
>
> OCPersistentStorage ps = {};
>
> ps.open = client_fopen;
>
> ps.read = fread;
>
> ps.write = fwrite;
>
> ps.close = fclose;
>
> ps.unlink = unlink;
>
>
>
> This gets a warning about each line, like:
>
>
>
> warning: missing initializer for member
> 'OCPersistentStorage::open'
>
>
>
> I can eliminate the warnings by coding it thus:
>
>
>
> OCPersistentStorage ps = { client_fopen, fread, fwrite, fclose,
> unlink };
>
> OCRegisterPersistentStorageHandler(&ps);
>
>
>
> But this seems more fragile since the ordering matters.
>
>
>
> Is there a C initialization method I?m missing?
>
>
>
> John
>
>
> _______________________________________________
> iotivity-dev mailing list
> iotivity-dev at lists.iotivity.org
> https://lists.iotivity.org/mailman/listinfo/iotivity-dev