bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FYI: line nums in C++


From: Paul Eggert
Subject: Re: FYI: line nums in C++
Date: 19 Feb 2003 13:07:35 -0800
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.3

Akim Demaille <address@hidden> writes:

> -          << " (line " << rline_[n_] << "), ";
> +               << " (line " << static_cast <unsigned> (rline_[n_]) << "), ";

This is the first use of static_cast in lalr1.cc.  I checked, and
static_cast wasn't in the original C++, though it was introduced in
the first informal C++ draft in December 1993.

This can easily be programmed around and and it might make sense to
rewrite the code to something like the following anyway, as it's more
readable when one avoids the cast:

      unsigned int l_ = rline_[n_];
      YYCDEBUG << "Reducing via rule " << n_ - 1 << " (line " << l_ << "), ";

But this raises the more general issue: which C++ variant should
lalr1.cc assume?  In other words, should Bison-generated C++ parsers
assume the latest C++ standard (ISO/IEC 14882, dated 1998-09-01)?  Or
should they also be portable to earlier versions of C++?  I am not a
C++ expert and don't particularly care one way or the other, but the
answer to this question should be documented somewhere.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]