mladinox / miniz

Automatically exported from code.google.com/p/miniz
0 stars 0 forks source link

#defines stomp #20

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
You #define crc32 mz_crc32
, which is a function.

The result of this, is that if I do this.

// in another header
class Info
{
   int crc32;
};

// now include miniz, crc32 gets stomped
#include <miniz/miniz.h>

Info info;
info.crc32 = 10; // COMPILE FAIL
because that gets transformed to
info.mz_crc32 = 10;

Instead, perhaps use inline functions, eg

inline etc crc32(buffer, size) { return mz_crc32(buffer,size); }

same performance, less stomping.

Original issue reported on code.google.com by harris...@gmail.com on 8 Oct 2013 at 4:19