www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/09/14:28:31

From: "Anthony.Appleyard" <MCLSSAA2 AT fs2 DOT mt DOT umist DOT ac DOT uk>
Organization: Materials Science Centre
To: djgpp AT delorie DOT com
Date: Wed, 9 Apr 1997 14:07:51 GMT-1
Subject: Re: funny re user-defined ++ and -- operators
Reply-to: Anthony DOT Appleyard AT umist DOT ac DOT uk
Message-ID: <7DF09C6867@fs2.mt.umist.ac.uk>

Alaric B. Williams wrote:-
> operator++(int) is postfix
> operator++() is prefix
> The ugliest syntax hack ever to see the light of day :-(

  Chris Croughton <crough45 AT amc DOT de> replied:-
> Not quite, I think, but close. However, it's certainly one of the most
> counter-intuitive ones - the first looks prefix, with the parameter after
> the operator, and the second looks postfix with the variable obviously
> before (as in x.operator++()).

  It seems clear to me.
  operator++() is monadic prefix, same as e.g. operator*() is prefix: `++X'
  operator++(int) is dyadic with a null 2nd arg, e.g. `X ++ <null>' == `X++'

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019