Is this a bug?

Daniel_Roedding at fiction.ms.sub.org Daniel_Roedding at fiction.ms.sub.org
Sun Sep 9 17:33:11 AEST 1990


rob at raksha.eng.ohio-state.edu (Rob Carriere) writes:

> I have code that looks like this:

> typedef union ut { T1 e1; T2 e2 } ut;
                ^^                  ^^
                ||                  ||
                Ouch - this is not what you'd call elegant, is it??

> void f( int const p1, ut const p2 );
> void foo( void )
> {
>    int i;   ut u;
>    ...
>    f( i, u );      /* ERROR: typemismatch in parameter p2 in function f */
>    ...
> }

> Calling it like so _does_ work

>    f( i, *(ut const *)&u );

It really seems to be a bug. But if you omit the "const" modifier, you'll
have less trouble. I think many compilers don't know how to handle "const"
correctly.

BTW: Passing structures per value?? Have a stack size > 1 Meg?? :-)

Daniel

---
..!uunet!mcsun!unido!mcshh!veeble!fiction!daniel; daniel at fiction.ms.sub.org

if (*++*argv!='=')
   (s->out=(void (*)(int,int,char *,...))outvstr)(s->id,s->spec,s->fmt);

I *love* C... :-)



More information about the Comp.lang.c mailing list