Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2002-11-15 18:07:11


>From: "Gennaro Prota" <gennaro_prota_at_[hidden]>

> On Fri, 15 Nov 2002 16:05:05 -0500, David Abrahams
> <dave_at_[hidden]> wrote:
>
> >Douglas Gregor <gregod_at_[hidden]> writes:
> >> You'll have to back that up with some standardese. AFAICT, 5.2.10/10
lets
> >> addressof() work:
> >> "That is, a reference cast reinterpret_cast<T&>(x) has the same
effect as
> >> the conversion *reinterpret_cast<T*>(&x) with the builtin & and *
operators."
> >>
> >> (And that reinterpret casting T* -> U* -> T* preserves the original
value).
> >
> >But you're not doing that. You're doing a reinterpret_cast T& -> U
> >cv&, then taking the address, and reinterpret_casting to T*. Is that
> >really covered by the standard?
>
> Who knows? When I encounter these sorts of situations I dream a
> standard where propositions can be demonstrated like in mathematics or
> counter-examples provided. Don't you?

You're not the only one. Bjarne Stroustrup says the same in "The Design and
Evolution of C++" (p. 103):

--- Start quote ---

Tools for Language Design

Theory and tools more advanced than a blackboard have not been given much
space in the description of the design and evolution of C++. I tried to use
YACC (an LALR(1) parser generator) for the grammar work, and was defeated by
C's syntax. I looked at denotional semantics, but was again defeated by
quirks in C. Ravi Sethi had looked into that problem and found that he
couldn't express the C semantics that way.

The main problem was the irregularity of C and a number of
implementation-dependent and undefined aspects of a C implementation. Much
later, the ANSI/ISO C++ committee had a stream of formal definition experts
explain their techniques and tools and give their opinions of the extent to
which a genuine formal approach to the definition of C++ would help us in
the standards effort. I also looked at the formal specifications of ML and
Modula-2 to see if a formal approach was likely to lead to a shorter and
more elegant description than traditional English text would. I don't think
that such a description of C++ would be less likely to be misinterpreted by
implementers and expert users. My conclusion is that a formal definition of
a language that is not designed together with a formal definition method is
beyond the ability of all but a handful of experts in formal definition.
This confirms my conclusion at the time.

--- End quote ---

Another comment, regarding using Spirit for parsing C++ that has been
discussed here (D&E, p. 69):

"To this day, Cfront has a YACC parser supplemented by much lexical trickery
relying on recursive descent techniques. On the other hand, it _is_ possible
to write an efficient and reasonably nice recursive descent parser for C++.
Several modern C++ compilers use recursive descent."

Regards,

Terje


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk