Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
969 Views

int c = a <? b; // what is it ? operator ? digraph ? compiler options ?

I search information about this instruction : int c = a <? b; 

 

A sample of code who compiled with an older version of nios2-elf-gcc (NIOS II EDS 6.0) :  

 

int foo(int a, int b) { int c = a <? b; ... } 

 

an operator ? 

a digrah ? 

what is it ? 

 

what compiler options to use with nios2-elf-gcc (NIOS II EDS 13.1) ? 

 

Thanks
0 Kudos
6 Replies
Altera_Forum
Honored Contributor I
31 Views

Looks like a typo, or something tried to process it in some markup language and got confused. 

You'll probably have to work out what was meant from the context.
Altera_Forum
Honored Contributor I
31 Views

 

--- Quote Start ---  

Looks like a typo, or something tried to process it in some markup language and got confused. 

You'll probably have to work out what was meant from the context. 

--- Quote End ---  

 

 

This instruction exist really in the code and compile with an older version of nios2-elf-gcc (NIOS II EDS 6.0), that s not a markup or a typo :( (I do a migration of an older code which compil)
Altera_Forum
Honored Contributor I
31 Views

It doesn't look like valid C. The ? operator is only used in a "test ? if_true : if_false" construction. Are you sure that this code line was actually compiled with your older version of gcc? Could it be excluded with an# ifdef ?

Altera_Forum
Honored Contributor I
31 Views

gcc has supported some 'extensions' in the past, their use is discouraged and I don't know the syntax. 

There was one for: if (x != 0); return x; 

And there might have been one for min/max - which could be the one you have there. 

With enough actual context you should be able to work out what has intended.
Altera_Forum
Honored Contributor I
31 Views

Oh yes you are right! GCC versions prior to 4.0 supported the <? (min) and >? (max) operators, as well as <?= and >?= to assign min and max values. Those were deprecated in 4.0. 

You can probably replace them with MIN() and MAX() macros or functions.
Altera_Forum
Honored Contributor I
31 Views

 

--- Quote Start ---  

Oh yes you are right! GCC versions prior to 4.0 supported the <? (min) and >? (max) operators, as well as <?= and >?= to assign min and max values. Those were deprecated in 4.0. 

You can probably replace them with MIN() and MAX() macros or functions. 

--- Quote End ---  

 

 

This is consistent with the code of my application. 

 

 

 

 

Thank you very much.
Reply