Sujet : Re: C89 "bug"
De : antispam (at) *nospam* fricas.org (Waldek Hebisch)
Groupes : comp.lang.cDate : 14. Dec 2024, 06:46:20
Autres entêtes
Organisation : To protect and to server
Message-ID : <vjj63a$24no4$2@paganini.bofh.team>
References : 1
User-Agent : tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
Thiago Adams <
thiago.adams@gmail.com> wrote:
Does anyone knows how can I convert this code (external declaration) to C89?
union U {
int i;
double d;
};
union U u = {.d=1.2};
The problem is that in C89 only the first member of the union is
initialized.
The following:
union U {
int i;
double d;
};
union U u = (union U)(1.2);
is accepted by 'gcc -S -std=c90'. I leave to others to check
if this is valid C89.
-- Waldek Hebisch