I have a bit of code that uses openipmi and has borrowed a lot from the example code on reading sensors, rather than reinventing the wheel. Reading threshold sensors is done by iterating through an enum. This worked fine in RHEL3 (gcc 3.2.3, icc-8.1, and icc-9.0), but won't compile in gcc-3.4.4 (RHEL4). The errors are all related to the casting of the ipmi_thresh_e from int to enum and back. I've tried it both ways, and I can't seem to find a way that works:

If I use a thresh object, cast to an int to increment it (   ((int)thresh)++;   ), I get this error:

error: ISO C++ forbids cast to non-reference type used as lvalue

if I use an int throughout and try to pass it as an enum into a function I get this error:

error: invalid conversion from `int' to `ipmi_thresh_e'
error:   initializing argument 2 of `int ipmi_sensor_threshold_reading_supported(ipmi_sensor_t*, ipmi_thresh_e, int*)'

Any suggestions on what I should try? Thanks

 - Jeff

Reply via email to