Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12596 Discussions

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

Altera_Forum
Honored Contributor II
1,354 Views

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 II
416 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.
0 Kudos
Altera_Forum
Honored Contributor II
416 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)
0 Kudos
Altera_Forum
Honored Contributor II
416 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 ?

0 Kudos
Altera_Forum
Honored Contributor II
416 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.
0 Kudos
Altera_Forum
Honored Contributor II
416 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.
0 Kudos
Altera_Forum
Honored Contributor II
416 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.
0 Kudos
Reply