On Sun, 21 Jun 2009, Szak�ts Viktor wrote:

Hi,

> Can this expression be optimized by compiler to NOP:
>    Do( NIL )
> I'm trying to make this work in every situation:
> #if defined( __HB_OUTDEBUG__ ) .AND. defined( __PLATFORM__WINDOWS )
>    #xtranslate HB_OUTDEBUG( [<x>] ) => WAPI_OUTPUTDEBUGSTRING( <x> )
> #else
>    #xtranslate HB_OUTDEBUG( [<x>] ) => ( Do( NIL ) )
> #endif
> Something would be needed which is converted to
> a complete dummy expression to allow usage in
> codeblocks, but which would be optimized out by
> the compiler to NIL or nothing depending on the
> situation.
> Or maybe there are better ideas for this.

#if defined( __HB_OUTDEBUG__ ) .AND. defined( __PLATFORM__WINDOWS )
   #xtranslate HB_OUTDEBUG( [<x,...>] ) => WAPI_OUTPUTDEBUGSTRING( <x> )
#else
   #xtranslate HB_OUTDEBUG( [<x,...>] ) => IIF(.T.,,)
#endif

IIF(.T.,,) is optimized by compiler to nothing (fully stripped) in
code like:

   IIF(.T.,,)
   ? IIF(.T.,,)

and to NIL in code like:

   {|| IIF(.T.,,) }
   x := IIF(.T.,,)
   ? IIF(.T.,,), "next"

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to