How can I initialize the union in const struct?
<pre><code> const struct EbmlSyntax {
    uint32_t id;
    EbmlType type;
    int list_elem_size;
    int data_offset;
    union {
        uint64_t    u;
        double      f;
        const char *s;
        const struct EbmlSyntax *n;
    } def;
} ;
</code></pre>

<p>I have to use the const struct above and want to create a a constant struct using </p>

<p><code>{ EBML_ID_DOCTYPE,                EBML_STR,  0, offsetof(Ebml,doctype), {.def.s = "(none)"} }</code></p>

<p>But, the VS8.0 compiler gives an error error C2143: syntax error : missing '}' before '.' when I compiler the C++ project.</p>

<p>I have tried several methods ,but, I only find the way that cast the char * to uint64_t(assign to the first type), </p>

<pre><code>(uint64_t)("none")
</code></pre>

<p>and I can use the union. Is this method safe? I check the structure of this and other struct-union object using VS debug tools.It seems OK that the member of struct and union can correctly expained.</p>
