This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: c++ "with" keyword
- From: Tolga Dalman <ates100 at web dot de>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 4 Jan 2003 20:28:19 +0000
- Subject: Re: c++ "with" keyword
- References: <20030104191316.D3B26F28C4@nile.gnat.com>
On Sat, 4 Jan 2003 14:13:16 -0500 (EST) dewar@gnat.com (Robert Dewar) wrote:
> > ... and potentially two new variables in your code and binary.
> > what i wanted to have:
> >
> >
> > {
> > #define y long_descriptive_expression_I_dont_like_repeating;
> > #define z long_descriptive_expression_I_dont_like_repeating;
> >
> > z.memberA = z.memberB;
> > z.memberB = y.memberA;
> > #undef z
> > #undef y
> > }
> >
> > but this is just ugly.
>
> Saying something is ugly is not an argument. It is the absence of a useful
> argument. What are you suggesting we do, take a vote to find out which
> form more people find ugly?
>
> (hint: you will probably lose, most C++ programmers will be quite familiar
> with the construct above, but will find the proposed WITH unfamiliar and
> thus ugly).
>
> As for two new variables. One would hope not, a stupid compiler might do
> that, but then a stupid compiler might generate junk copies to implement
> WITH. You really can't base arguments on fantasies about what stupid
> compilers might or might not do.
>
> In short, you have given no technical arguments to prefer your new form
> over the familiar existing technique.
using the method you proposed will possibly degrade the code, wheras using
macros (and "with" should be implemented into the cpp) has never any runtime
penalties.
btw, being ugly or not is not the question here (as you said, we could
argue about), but rather having a clean programming style with an appropriate
language. i do regard using macro definitions within "normal" code
as blasphemical as using "goto" now and then...
Tolga Dalman.