Author Topic: Logical operators in conditional assembly  (Read 3807 times)

Yuri

  • Member
  • **
  • Posts: 175
Logical operators in conditional assembly
« on: January 01, 2013, 03:51:16 PM »
It seems GoAsm currently doesn't support them. I mean things like
Code: [Select]
#if defined(A) || defined(B)
or
Code: [Select]
#if A && B

Is there any chance they could be implemented?

I now use a workaround for the first example:
Code: [Select]
#if defined(A)
    x = 1
#elif defined(B)
    x = 1
#else
    x = 0
#endif

#if x == 1
    some code
#endif
#undef x

But it's way too long and the readability of code suffers from this (I need about 80 such wrappings throughout the code).

wjr

  • Member
  • **
  • Posts: 207
    • WJR's website
Re: Logical operators in conditional assembly
« Reply #1 on: January 06, 2013, 01:47:44 PM »
For "any chance really soon" I would have to say probably not, for me at least - enough on the Go with remaining 64-bit issues that need to be resolved.

For "any chance", I could go with maybe, as I took a quick look and it seems like the current simple "expression1 relational-operator expression2" format could be extended to include logical-operators, as in the examples that you have shown. Actually, this looks much easier than what I am working on above, so in some spare time may dig a bit further into this one...

However, if you were expecting to create more complex conditional expressions including multiple logical-operators with multiple relational-operator expressions (as sometimes seen in the header files), that would be a bit too much, for me at least.

Yuri

  • Member
  • **
  • Posts: 175
Re: Logical operators in conditional assembly
« Reply #2 on: January 06, 2013, 02:37:30 PM »
Thanks for the reply, Wayne. Personally I would be happy with just two operands, like in my examples above. I think more complex conditions are a rare case.