Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Bugs and Fixes

expr ? : error

A community discussion post from the original code:zIRON forum.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

expr ? : error

there is error in ? : expr , try compile this

program PE32_CUI 'test application';

#include 'platform_def.zir';
#include 'console.zir';

function abs(int32 n)
{  
   eax = (n >= 0) ? n : -n;
}

edx = abs(100);
print('Number: ', [dword]edx ,'\r\n');

wait_key();
ExitProcess(0);

http://www.freewebs.com/ogremagic/index.htm

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

I have added support for this for next release. Thanks.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok this work

 eax = (n >= 0) ? n : -n;

but why this not

  return (n >= 0) ? n : -n;

what came after '=' or 'return; is supposed to be expression pares.

http://www.freewebs.com/ogremagic/index.htm

Colin admin
Posts
928
Threads
49
Location
Bulgaria

Added support for this, thanks for request, it was a good idea :)