Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Requests and Feedback

if with function test

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

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

if with function test

Hi Colin.

why ziron did not allow directly use a function that returns Boolean inside if block?

something like that

  if(Ziron_SetFileBuffer(handle, mem ,H_strlen(mem)) == false)
     {
         Ziron_FatalError('error when set File Buffer');
     }  

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

Replies

Molotov member
Posts
49
Threads
21
Location
Behind Keyboard

if you need that.. you could make a macro for it..

It´s as simple as that..

"Lerning new things is what life is all about, if you are always doing the same old things day in and day out you might aswell just kill yourself." - ME d^_^b

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

yes , you can make a macro to allow useing function inside if statement , but.........

you have to create a macro for each function , and this is not prefered.

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

I have added this in current uploaded beta, if statements will accept a function only for the first parameter (for now)

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt
if statements will accept a function only for the first parameter

sorry i did not get you , can you explain more detail please?

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

Colin admin
Posts
928
Threads
49
Location
Bulgaria

acceptable:

if (GetMessage(@msg, 0, 0, 0)) { ...

if (myFunc() = false) { ...

not acceptable:

if (eax == myFunc()) { ...

if (myVar == myFunc()) { ...