Thread overview | |||||
---|---|---|---|---|---|
|
July 11, 2003 Anonimous structs and unions | ||||
---|---|---|---|---|
| ||||
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 Re: Anonimous structs and unions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dario | 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 Re: Anonimous structs and unions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | >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 > |
Copyright © 1999-2021 by the D Language Foundation