13

Possible Duplicate:
C extension: <? and >? operators

Take a look at the top answer (by sclo) to problem D of this Google Code Jam. It's C++ code, it must have compiled, and it contains statements such as this one:

double& ret = F[mask][cur][b];
if(j==cur) {
  ret<?=f(tmp,j,b||bad[i])+M[cur][i];   // WTF is <?=   ???
}

This doesn't compile in my Visual Studio 2008. What does the <?= mean?

Community
  • 1
  • 1
ripper234
  • 222,824
  • 274
  • 634
  • 905

4 Answers4

19

It's a gcc extension: C extension: <? and >? operators

Recent manuals say:

The G++ minimum and maximum operators (‘<?’ and ‘>?’) and their compound forms (‘<?=’) and ‘>?=’) have been deprecated and are now removed from G++. Code using these operators should be modified to use std::min and std::max instead...

Community
  • 1
  • 1
Luca Matteis
  • 29,161
  • 19
  • 114
  • 169
3

It's simply not valid C++. < Might be less than, an open angle bracket for a template argument list, or the start of a digraph however non of those can be followed by ?, then =.

CB Bailey
  • 755,051
  • 104
  • 632
  • 656
3

It's a now deprecated g++ extension to the c++ language.

a <? b is the minimum, returning the smaller of the numeric values a and b;

a >? b is the maximum, returning the larger of the numeric values a and b.

There are also compound versions

<?=

and

>?=

that do assignment as well.

plivesey
  • 59
  • 1
0

It doesn't compile also with GCC, and I've never heard of an operator <?=.

Anyway I would hazard a guess that a<?=b could have a semantics like: a = (a<b) ? b : a, but again, this is just a guess.

peoro
  • 25,562
  • 20
  • 98
  • 150