STk 2.1.4 assign to casts in process.c and socket.c

From: Brian Wallis <brw_at_tusc.com.au>
Date: Fri, 11 Nov 1994 14:37:02 +1100

I have problems compiling on HPUX. In the files process.c

  96: PROCESS(z) = (struct process_info *) must_malloc(sizeof(struct process_info));

and socket.c

  107: SOCKHANDLE(handle) = NULL;
  174: SOCKHANDLE(ys) = (struct socket_handle*)must_malloc(sizeof (struct socket_handle));

where PROCESS is
  #define PROCESS(x) ((struct process_info *)((x)->storage_as.extension.data))

and SOCKHANDLE is
  #define SOCKHANDLE(x) ((struct socket_handle*)(x->storage_as.extension.data))

These constructs are not quite legal ANSI C. I believe that the ANSI C
standard disallows assignment to a cast (ie: a cast is not an lvalue).

The HP C compiler in ANSI mode certainly doesn't allow this, gcc with
-pedantic give a warning that this is not legal ANSI C.

I replaced the offending lines using two other macros that have the cast
removed and this compiles OK with HP C (HP92453-01 A.09.61 HP C
Compiler)

Thanks for STk, it's great!

brian wallis... TUSC Computer Systems Pty.Ltd
<brw_at_tusc.com.au> 666 Doncaster Road
Phone: +61 3 840 2222 Doncaster, Victoria
Fax: +61 3 840 2277 Australia 3108
Received on Fri Nov 11 1994 - 05:20:20 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST