--On Tuesday, November 23, 2010 02:38:07 PM +0100 Alan DeKok <aland@deployingradius.com> wrote:
Giampiero Torrielli wrote:
I compiled and installed freeradius (freeradius-server-2.1.10) on a HPUX 11.31 Itanium V3 system, but I had to make some little code and makefile modifications.
I would like to tell you these changes
In the file : freeradius-server-2.1.10/src/modules/rlm_eap/rlm_eap.c in the new function static int eap_handler_ptr_cmp, the HP CC compiler gives an error on the returning value type.
diff:
line 111 < return (a - b); ---
return ((int)a - (int)b);
Ugh. The result of subtracting two pointers is usually a signed integer. If you're pedantic, "ptrdiff_t". The compiler shouldn't require a cast to "int".
I'm not opposed to adding it, but it really doesn't do anything for ISO C compatible compilers.
You should be -- if the compiler accepts it at all, it changes the semantics. Casting void * to int is not strictly legal and won't work on platforms where void * is larger than int. That said, the existing code is not that great, either -- ptrdiff_t is not guaranteed to fit in an int; in fact, I just found a bug last night in another piece of software caused by ptrdiff_t being long. Of course, the OP hasn't reported what the original error was, so I can't really suggest a better fix, but I'll bet it involves changing the return type of eap_handler_ptr_cmp(). -- Jeff