Re: [PATCH] ORBit-0.5.1 on Tru64 UNIX (resend)



Aron Griffis <agriffis@bigfoot.com> writes:
[snip]
>  	retval = *(CORBA_long *)*val;
> -	if(update) *val += sizeof(CORBA_long);
> +	if(update) (char *)*val += sizeof(CORBA_long);
>  	break;
>      case CORBA_tk_ushort:
>      case CORBA_tk_short:
>  	retval = *(CORBA_short *)*val;
> -	if(update) *val += sizeof(CORBA_short);
> +	if(update) (char *)*val += sizeof(CORBA_short);
>  	break;
>      case CORBA_tk_char:
>      case CORBA_tk_boolean:
>      case CORBA_tk_octet:
>  	retval = *(CORBA_octet *)*val;
> -	if(update) *val += sizeof(CORBA_char);
> +	if(update) (char *)*val += sizeof(CORBA_char);
>  	break;

Yuck.

IIRC, lvalue casts are not Standard C.  So, I would much rather use 

    if (update) *val = (char *)*val + sizeof(foo);

Even clearer, IMHO, would be to use

  case CORBA_tk_foo:
    {
      CORBA_foo *p = *val; 
      retval = *p++;
      if (update) *val = p;
    }
    break;

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]