I like this feature request
I like this feature request
{$BEGINOPT R+,Q-}
...
{$ENDOPT}
https://quality.embarcadero.com/browse/RSP-14045
https://quality.embarcadero.com/browse/RSP-14045
{$BEGINOPT R+,Q-}
...
{$ENDOPT}
https://quality.embarcadero.com/browse/RSP-14045
https://quality.embarcadero.com/browse/RSP-14045
I assume you want the options to return to their previous settings at ENDOPT ?
ReplyDeleteThat would indeed be nice.
yes, it's to avoid such things
ReplyDelete{$IFOPT R+}
{$DEFINE R_PLUS}
{$R-}
{$ENDIF}
...
{$IFDEF R_PLUS}
{$R+}
{$UNDEF R_PLUS}
{$ENDIF}
Make an inc file with this content:
ReplyDelete{$IFNDEF R_PLUS}
{$IFOPT R+}
{$DEFINE R_PLUS}
{$R-}
{$ENDIF}
{$ELSE}
{$R+}
{$UNDEF R_PLUS}
{$ENDIF}
And then just include it where to turn on and off.
Stefan Glienke And you can create a collection of include files TURN_R_OFF.inc, TURN_R_ON.inc, TURN_Q_ON.inc etc :)
ReplyDeleteIMO better approach is {$PUSH}/{$POP}:
ReplyDelete{$PUSH}
{$R+}{$Q-}
...
{$POP}
Maciej Izak yes...but what's included in PUSH/POP, everything ? why not...or perhaps
ReplyDelete{$PUSH R,Q,ZEROBASEDSTRINGS}
{$IFDEF WIN64}
{$R-}
{$ENDIF}
...
{$POP}
Push/Pop would allow you to use the longform of the switches.
ReplyDeleteLars Fosdal yes, and you can play with flags like in my sample above (WIN64)...I've added a comment about that.
ReplyDelete...additionally {$PUSH}/{$POP} is compatible with FPC :)
ReplyDeleteMaciej Izak haha :) didn't know
ReplyDeletehttp://www.freepascal.org/docs-html/prog/progsu63.html#x70-690001.2.63