This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++ "with" keyword


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]