[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Texmacs-dev] GCC 3.2 status update
From: |
David Allouche |
Subject: |
Re: [Texmacs-dev] GCC 3.2 status update |
Date: |
Tue, 26 Nov 2002 20:01:13 +0100 |
User-agent: |
Mutt/1.4i |
On Tue, Nov 26, 2002 at 12:02:26AM +0300, Igor V. Kovalenko wrote:
> I have a question that is out of my expertise as I do not have
> current C/C++ standard book.
>
> Are you *sure* you do not violate ANSI data type aliasing rules
> by deleting a tree data in destroy_tree_rep() ?
>
> If this is indeed a violation than no one can help here from GCC front.
> At least not before GCC/3.4 development AFAIK.
>
> Sorry, I really can't get the current standard book :(
> Are there any Internet resources?
Sadly the ISO standard for C++ is only available for a price at ANSI
store. For a few american dollars you can get a PDF copy of the
standard.
I bought one some time ago so I had the Book if I want to explain to
some other hacker how crappy is C++ code is ;-)
For memory, here is the relevant code:
inline tree::~tree () {
if ((--rep->ref_count)==0) {
destroy_tree_rep (rep); rep= NULL; } }
void
destroy_tree_rep (tree_rep* rep) {
if (rep->op == STRING)
delete ((atomic_rep*) ((void*) rep));
else
delete ((compound_rep*) ((void*) rep));
}
Here are the relevant standard excerpts:
4.1 lvalue to rvalue conversion
15
If a programm attempts to access the stored value of an object
through an lvalue of other than one of the following types the
behavior is undefined [The intent of this list is to specify those
circumstances in which an object may or may not be aliased]:
-- the dynamic type of the object,
-- a cv-qualified version of the dynamic type of the object,
-- a type that is the signed or unsigned type corresponding to the
dynamic type of the object,
-- a type that is the signed or unsigned type corresponding to a
cv-qualified version of the dynamic type of the object,
-- an aggregate or union type that includes one of the
aformentioned types among its members (including, recursively, a
member of a subaggregate or contained union),
-- a type that is a (possibly cv-qualified) base class type of the
dynamic type of the object.
-- a char or unsigned char type.
There might be more, but that is all I found.
The tree destruction code seems to be compliant. But is uses the evil
C-style cast... generally C-style cast should be replaced by more
specific (and safer) operation in C++.
--
David Allouche | GNU TeXmacs -- Writing is a pleasure
Free software engineer | http://www.texmacs.org
http://ddaa.net | http://alqua.com/tmresources
address@hidden | address@hidden
TeXmacs is NOT a LaTeX front-end and is unrelated to emacs.
- Re: [Texmacs-dev] Usability of TeXmacs on 2 year old computers, (continued)
- Re: [Texmacs-dev] Usability of TeXmacs on 2 year old computers, Álvaro Tejero Cantero, 2002/11/13
- Re: [Texmacs-dev] Usability of TeXmacs on 2 year old computers, David Allouche, 2002/11/13
- Re: [Texmacs-dev] GCC 3.2 status update, Felix Breuer, 2002/11/12
- Re: [Texmacs-dev] GCC 3.2 status update, Alexander Isacson, 2002/11/12
- Re: [Texmacs-dev] GCC 3.2 status update, Felix Breuer, 2002/11/12
- Re: [Texmacs-dev] GCC 3.2 status update, Alexander Isacson, 2002/11/12
- Re: [Texmacs-dev] GCC 3.2 status update, Igor V. Kovalenko, 2002/11/12
- Re: [Texmacs-dev] GCC 3.2 status update, Igor V. Kovalenko, 2002/11/25
- Re: [Texmacs-dev] GCC 3.2 status update, Joris van der Hoeven, 2002/11/25
- Re: [Texmacs-dev] GCC 3.2 status update, Igor V. Kovalenko, 2002/11/25
- Re: [Texmacs-dev] GCC 3.2 status update,
David Allouche <=
- Re: [Texmacs-dev] GCC 3.2 status update, Igor V. Kovalenko, 2002/11/26
- Re: [Texmacs-dev] GCC 3.2 status update, David Allouche, 2002/11/27
- Re: [Texmacs-dev] GCC 3.2 status update, Joris van der Hoeven, 2002/11/27
- Re: [Texmacs-dev] GCC 3.2 status update, David Allouche, 2002/11/27
- Re: [Texmacs-dev] GCC 3.2 status update, Joris van der Hoeven, 2002/11/27
- Re: [Texmacs-dev] GCC 3.2 status update, David Allouche, 2002/11/27
- Re: [Texmacs-dev] GCC 3.2 status update, Joris van der Hoeven, 2002/11/27
Re: [Texmacs-dev] [PATCH] solves GCC 3.2 auto_save segfault for me..., Joris van der Hoeven, 2002/11/05