D - Anonimous structs and unions
- Dario (13/13) Jul 11 2003 Why don't anonimous structs and unions work if written in a function sco...
- Sean L. Palmer (7/20) Jul 12 2003 You can work around by using a named struct or union, no?
- Dario (2/6) Jul 12 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; }
Jul 11 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 functionscope? Thiswould be useful for specifying the stack frame's layout. For example: uint func(float a) { union { uint b; float c; } c = a; return b; }
Jul 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
Jul 12 2003