www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Colons and brackets

reply Etienne Cimon <etcimon gmail.com> writes:
Hi all,

I'm a little perplexed b/c I can't seem to find anything that could tell 
me where this ends:

version(something):
code
code
code
\eof

How do you stop statements from belonging to the specific version of 
code without using brackets?

Thanks!
Feb 27 2014
parent reply "evilrat" <evilrat666 gmail.com> writes:
On Friday, 28 February 2014 at 04:19:47 UTC, Etienne Cimon wrote:
 Hi all,

 I'm a little perplexed b/c I can't seem to find anything that 
 could tell me where this ends:

 version(something):
 code
 code
 code
 \eof

 How do you stop statements from belonging to the specific 
 version of code without using brackets?

 Thanks!
add "version(all):" after code where specific version ends.
Feb 27 2014
next sibling parent reply "anonymous" <anonymous example.com> writes:
On Friday, 28 February 2014 at 04:31:03 UTC, evilrat wrote:
 On Friday, 28 February 2014 at 04:19:47 UTC, Etienne Cimon 
 wrote:
 Hi all,

 I'm a little perplexed b/c I can't seem to find anything that 
 could tell me where this ends:

 version(something):
 code
 code
 code
 \eof

 How do you stop statements from belonging to the specific 
 version of code without using brackets?

 Thanks!
add "version(all):" after code where specific version ends.
nope
Feb 28 2014
parent reply Etienne <etcimon gmail.com> writes:
On 2014-02-28 7:53 AM, anonymous wrote:
 nope
nope?
Mar 01 2014
next sibling parent Etienne <etcimon gmail.com> writes:
On 2014-03-01 4:14 PM, Etienne wrote:
 On 2014-02-28 7:53 AM, anonymous wrote:
 nope
nope?
Can someone refute this anonymous nope?
Mar 01 2014
prev sibling parent reply "anonymous" <anonymous example.com> writes:
On Saturday, 1 March 2014 at 21:14:53 UTC, Etienne wrote:
 On 2014-02-28 7:53 AM, anonymous wrote:
 nope
nope?
yep ;) The nope was directed at this statement specifically: On Friday, 28 February 2014 at 04:31:03 UTC, evilrat wrote:
 add "version(all):" after code where specific version ends.
I.e. "version(all):" doesn't cancel a former "version(foo):". There may or may not be a way to cancel a "version(foo):". I can't think of anything. Also, I don't see the problem with brackets.
Mar 01 2014
next sibling parent reply "evilrat" <evilrat666 gmail.com> writes:
On Saturday, 1 March 2014 at 21:42:56 UTC, anonymous wrote:
 On Saturday, 1 March 2014 at 21:14:53 UTC, Etienne wrote:
 On 2014-02-28 7:53 AM, anonymous wrote:
 nope
nope?
yep ;) The nope was directed at this statement specifically: On Friday, 28 February 2014 at 04:31:03 UTC, evilrat wrote:
 add "version(all):" after code where specific version ends.
I.e. "version(all):" doesn't cancel a former "version(foo):". There may or may not be a way to cancel a "version(foo):". I can't think of anything. Also, I don't see the problem with brackets.
of course it doesn't cancel it. it just re-enables code after descending version operator. versions can only be enabled via compiler args or CTFE.
Mar 01 2014
parent "evilrat" <evilrat666 gmail.com> writes:
On Sunday, 2 March 2014 at 05:23:21 UTC, evilrat wrote:
 On Saturday, 1 March 2014 at 21:42:56 UTC, anonymous wrote:
 On Saturday, 1 March 2014 at 21:14:53 UTC, Etienne wrote:
 On 2014-02-28 7:53 AM, anonymous wrote:
 nope
nope?
yep ;) The nope was directed at this statement specifically: On Friday, 28 February 2014 at 04:31:03 UTC, evilrat wrote:
 add "version(all):" after code where specific version ends.
I.e. "version(all):" doesn't cancel a former "version(foo):". There may or may not be a way to cancel a "version(foo):". I can't think of anything. Also, I don't see the problem with brackets.
of course it doesn't cancel it. it just re-enables code after descending version operator. versions can only be enabled via compiler args or CTFE.
oh. sorry, i remembere i have same problems with version:, back then i switched to brackets.
Mar 01 2014
prev sibling parent Etienne Cimon <etcimon gmail.com> writes:
On 2014-03-01 16:42, anonymous wrote:
 I.e. "version(all):" doesn't cancel a former "version(foo):".
 There may or may not be a way to cancel a "version(foo):". I
 can't think of anything. Also, I don't see the problem with
 brackets.
Brackets (braces) with "good practice" requires changing the indentation of everything in it :/ To keep it clean I decided to put the different sources in separate files and put the version clause near the import or with version (DEFINES): at the top of the page..
Mar 02 2014
prev sibling parent "Daniel Murphy" <yebbliesnospam gmail.com> writes:
"evilrat"  wrote in message news:mxhmgkljrzqhaymeclvk forum.dlang.org...
On Friday, 28 February 2014 at 04:19:47 UTC, Etienne Cimon wrote:
 How do you stop statements from belonging to the specific version of 
 code without using brackets?
add "version(all):" after code where specific version ends.
This is incorrect, there is no way to do this. The compiler translates version(...): ... into version(...) { ... } So any version labels after the first are moved inside the first. You can see it with this code: version = y; version(x): pragma(msg, "versionx"); version(y): pragma(msg, "versiony"); Nothing is printed, because the version(y) block is inside the version(x) block, and version(x) is not set. The answer: use braces.
Mar 02 2014