Microsoft has been busy implementing a new type of operators in C++ called "tadpole" operators (named so because they look like ASCII tadpoles).

Microsoft has been busy implementing a new type of operators in C++ called "tadpole" operators (named so because they look like ASCII tadpoles).
These will allow you to save a large number of parantheses that you would otherwise have to write due to operator precedence.

More information here:
http://blogs.msdn.com/b/oldnewthing/archive/2015/05/25/10616865.aspx

Of course Microsoft is behind the times on this and this has been possible in delphi for a long time.

Examples:
WriteLn(not - 5);
> Prints "4"
WriteLn( not 5);
-> Prints "6"

As usual though the Delphi syntax is more verbose than the cleaner C++ implementation.
http://blogs.msdn.com/b/oldnewthing/archive/2015/05/25/10616865.aspx

Comments

  1. LOL. Took me a while... ;-) Well played.

    ReplyDelete
  2. The define is meaningless... because ~ would work anyway...? I'm confused.

    Seems a joke post, but a really weird one.

    Ondrej Kelle If you "get" it, please illuminate :)

    ReplyDelete
  3. David Millington Yes, both ~ and - are unary operators, one's complement and negation, respectively. So ~-x already works as (x - 1), and -~x as (x + 1).

    ReplyDelete
  4. Yeah. So... maybe I'm missing the point of the post, here and on MSDN. If you "get" it, can you explain please?

    ReplyDelete
  5. Very simple: Troll. :-) See the reactions in the comments.

    ReplyDelete
  6. I suppose I got trolled too then :)

    ReplyDelete

Post a Comment