views:

101

answers:

2

I observed that there was at some point a <? and >? operator in GCC. How can I use these under GCC 4.5? Have they been removed, and if so, when?

Offset block_count = (cpfs->geo.block_size - block_offset) <? count;
cpfs.c:473: error: expected expression before ‘?’ token
+5  A: 

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.

A quick search of the past documents seems to indicate that they were removed around version 4.0 (3.4.6 includes them, 4.0.4 does not).

Carl Norum
I may have misread, they were only available on G++?
Matt Joiner
@Matt Joiner, That's what the docs say, yes: "GNU C++ (but not in GNU C)".
Carl Norum
I'd like to give +1 if you can provide a link.
Matt Joiner
@Matt Joiner, SRSLY? How about google? Here: http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/
Carl Norum
+2  A: 

If that's a min function, I would just use:

Offset block_count = cpfs->geo.block_size - block_offset;
if (block_count > count) block_count = count;

or std::min. I'm not a big fan of using C/C++ "extensions" since they tie me to a specific implementation of the language.

You should never use a non-standard extension where a perfectly adequate standard method is available.

paxdiablo