|
Archives
D Programming
digitalmars.Ddigitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger D.gnu D C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D.learn - Union literals? (D1.0)
Is there union literals?
I have this (example):
struct A
{
int x;
}
struct B
{
char z;
}
struct C
{
int y;
union U
{
A a;
static struct D
{
B b;
uint domain;
}
D d;
}
U u;
}
Is there any way to initialize a C in one line (so it can be const)? Like:
const c = C(10, C.U.D(B('b'), 15));
But I get: Error: cannot implicitly convert expression (D((B('b')),15u))
of type D to A.
Unions can only be initalized to its first member?
--
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
Salvajes, de traje, me quieren enseƱar
Salvajes, de traje, me quieren educar
Feb 07 2008
"Leandro Lucarella" <llucax gmail.com> wrote in message news:20080207212438.GB16062 burns.springfield.home... Feb 07 2008
|