Thread overview
Anonimous structs and unions
Jul 11, 2003
Dario
Jul 12, 2003
Sean L. Palmer
Jul 12, 2003
Dario
July 11, 2003
Why don't anonimous structs and unions work if written in a function scope? This
would be useful for specifying the stack frame's layout.
For example:
uint func(float a)
{
union
{
uint b;
float c;
}
c = a;
return b;
}


July 12, 2003
You can work around by using a named struct or union, no?

But yes, this should be consistent.

But to avoid the copy, perhaps the good old pointer cast might be better.

Sean

"Dario" <Dario_member@pathlink.com> wrote in message news:benefa$2kas$1@digitaldaemon.com...
> Why don't anonimous structs and unions work if written in a function
scope? This
> would be useful for specifying the stack frame's layout.
> For example:
> uint func(float a)
> {
> union
> {
> uint b;
> float c;
> }
> c = a;
> return b;
> }


July 12, 2003
>You can work around by using a named struct or union, no?
>
>But yes, this should be consistent.
>
>But to avoid the copy, perhaps the good old pointer cast might be better.

Yes you're right. I only wanted to show what I meant:
I wasn't able to think of a better example. :-)

>
>Sean
>