nix icon indicating copy to clipboard operation
nix copied to clipboard

[win] Have a closer look at C4251

Open gicmo opened this issue 10 years ago • 4 comments

Investigate the warning C4251 on windows (cf. http://msdn.microsoft.com/en-us/library/esew7y1w.aspx )

gicmo avatar Mar 04 '14 14:03 gicmo

My reasoning about why this is happened turned out to be correct but the best description, and possible solutions are given here:

  • http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html
  • http://support.microsoft.com/default.aspx?scid=KB;EN-US;168958

gicmo avatar Mar 07 '14 22:03 gicmo

I will deal with this mess for the Second Alpha

gicmo avatar Mar 08 '14 13:03 gicmo

Yes this is a bit messy - thanks for the helpful links! I think the "unknownroad" article has some feasible solutions:

-Don't use templates: if you can, get rid of the template and you get rid of the problem -Ignore the warning: it seems the VC compiler correctly solves the problem mostly. While this might seem unsafe since it might depend on compiler version, ironically it is safer than the "solution" to explicitly instantiate the template, which might mean double definition if done in more than one used DLL => linker error. -Private STL Containers! While this does not get rid of the warning, it definitely should get rid of any problems, since private members are not accessible to DLL users and thus don't need to be exported.

I personally would propose to go with the 3rd option and ignore the warning - this should be safe as far as I understand. What do you think @gicmo?

balint42 avatar Apr 03 '14 15:04 balint42

@gicmo Currently the C4251 warning only appears inside the HDF5 header H5Exception.h. Is there really something we can do about this?

stoewer avatar Aug 12 '14 15:08 stoewer