Archived

This forum has been archived. Please start a new discussion on GitHub.

slice2cpp -U to undef min and max macros

I have a slice struct which contains members min and max. This works fine
with gcc. When I use a MSVC compiler it complains about not enough
actual parameters for macro min. Oops, forgot that MSVC has legacy
macros for min and max.

Solution, undef min and max. However this has to be done by the
slice2cpp program. I noticed there is a -U argument to slice2cpp
which would solve the problem. However I can't seem to get it
generate the undef statements (tried both `-Umin' and `-U min').

I had a bit of a look through
src/slice2cpp/Gen.cpp
src/Slice/Preprocessor.cpp
but couldn't find where it output the undef statements.

I thought it would be around line 253 of Gen.cpp (3.0.1). After:-

H << "\n#include <Ice/UndefSysMacros.h>";


Regards

Stuart

Comments

  • bernard
    bernard Jupiter, FL
    Have you considered editing Ice/UndefSysMacros.h to undefine min and max?

    Cheers,
    Bernard
  • Thanks Bernard,

    Good solution.

    I just ended up renaming min to minVal etc. Not a big change.

    Got a bit sidetracked on why -U wouldn't work.

    Thanks

    Stuart