[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bison 1.30f
From: |
Hans Aberg |
Subject: |
Re: Bison 1.30f |
Date: |
Sat, 15 Dec 2001 16:58:21 +0100 |
At 13:51 +0100 2001/12/15, Hans Aberg wrote:
>The second problem is that one has
> union yyalloc *yyptr = ...
>and
> union yyalloc
> {
> short yyss;
> YYSTYPE yyvs;
> # if YYLSP_NEEDED
> YYLTYPE yyls;
> # endif
> };
>and unions are under C++ only allowed (or so I recall) for POD's (plain
>ol' data's), basically data types which does not have non-trivial
>constructors.
>
>So I am not really sure why my code compiled, as my YYSTYPE contains
>non-default constructors.
I looked this up, the C++ standard, verse 9.5:1, says about unions:
An object of a class with a non-trivial constructor (12.1), a non-trivial
copy constructor (12.8), a non-trivial destructor (12.4), or a non-trivial
copy assignment operator (13.5.3, 12.8) cannot be a member of a union, nor
can an
array of such objects.
So if a compiler has implemented C++ according to this, union yyalloc
should not compile if YYSTYPE has one of the above non-trivial
constructors. And the reason it compiled was that my C++ compiler is bad,
it seems.
Therefore, it may be prudent implementing genuine C++ support before C++
compilers become better, causing the code to fail. :-)
Hans Aberg
- Re: Bison 1.30f, (continued)
- Re: Bison 1.30f, Akim Demaille, 2001/12/13
- Re: Bison 1.30f, Hans Aberg, 2001/12/13
- Re: Bison 1.30f, Paul Eggert, 2001/12/13
- Re: Bison 1.30f, Hans Aberg, 2001/12/14
- Re: Bison 1.30f, Paul Eggert, 2001/12/14
- Re: Bison 1.30f, Hans Aberg, 2001/12/14
- Re: Bison 1.30f, Paul Eggert, 2001/12/14
- Re: Bison 1.30f, Hans Aberg, 2001/12/15
- Re: Bison 1.30f, Akim Demaille, 2001/12/15
- Re: Bison 1.30f, Hans Aberg, 2001/12/15
- Re: Bison 1.30f,
Hans Aberg <=
- Re: Bison 1.30f, Paul Eggert, 2001/12/17
- Re: Bison 1.30f, Paul Eggert, 2001/12/16
- Re: Bison 1.30f, Hans Aberg, 2001/12/16
- Re: Bison 1.30f, Paul Eggert, 2001/12/17
- Re: Bison 1.30f, Hans Aberg, 2001/12/18
- Re: Bison 1.30f, Paul Eggert, 2001/12/18
- Re: Bison 1.30f, Hans Aberg, 2001/12/19
- Re: Bison 1.30f, Paul Eggert, 2001/12/19
- Re: Bison 1.30f, Hans Aberg, 2001/12/20
- Re: Bison 1.30f, Magnus Fromreide, 2001/12/20