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: Akim Demaille
Subject: Re: FYI: line nums in C++
Date: Fri, 21 Feb 2003 09:06:16 +0100
User-agent: Gnus/5.090015 (Oort Gnus v0.15) Emacs/21.2

 Paul> It's no more imperative than the other style, as it merely gives a
 Paul> name to a subexpression.  That is commonly done even in purely
 Paul> functional languages.

 Paul> In C, another advantage of using the named subexpression is that it's
 Paul> more likely to catch a programming error.  If rline_[n_] happened to
 Paul> be of pointer type, the above code must cause the compiler to generate
 Paul> a diagnostic; this is not true of the static cast.  

Very true, thanks for the emphasis!  I'll follow your suggestion.

 Paul> The problem is that casts are too strong; they convert too many
 Paul> different types to the result type.  Initializers are weaker,
 Paul> and are thus more likely to catch coding errors.  I suspect
 Paul> that similar results hold for C++.

Yes, indeed.

 Paul> It's no big deal, of course.

But I do appreciate your comments anyway :)




reply via email to

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