CMA-ES/c-cmaes — pull request #11 by sherm1 (2014-11-26 00:54:49+00:00)
Title: Fix Microsoft C warnings

Microsoft C produces copious warnings when compiling `cmaes.c`. Most of them are warnings that functions like `fopen()` and `sscanf()` "may be unsafe". Microsoft provides a standard way to turn those off with a `#define`; this PR conditionally defines that macro when compiling with Microsoft C.

The remaining warnings were
- conversion of cmaes_t's `gen` field to a `long` (see issue CMA-ES/c-cmaes#10)
- conversion of `time_t` to `double`
- calling free on a pointer to const object (see

I added explicit casts to address these. I think the `time_t` conversions are fine. An alternate solution for the `gen` field would be to redefine it as a `long` or `long long` to avoid the float/int conversions. An alternate solution for the `free()` would be not to declare fields `rgsformat` and `rgskeyar` as const.

I have tested this on Visual C 2013 and on Ubuntu 14.04 with gcc 4.8.2.