Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!ira.uka.de!smurf!ipkama!freesid!mamnix!tjack!fiction!Daniel_Roedding From: Daniel_Roedding@fiction.ms.sub.org Newsgroups: comp.lang.c Subject: Re: Is this a bug? Message-ID: <404594@fiction> Date: 9 Sep 90 07:33:11 GMT Lines: 37 X-Attributes: type 2, from 100, acclv 0, expires rob@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@fiction.ms.sub.org if (*++*argv!='=') (s->out=(void (*)(int,int,char *,...))outvstr)(s->id,s->spec,s->fmt); I *love* C... :-)