Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 28, 2014 Colons and brackets | ||||
---|---|---|---|---|
| ||||
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! |
February 28, 2014 Re: Colons and brackets | ||||
---|---|---|---|---|
| ||||
Posted in reply to Etienne Cimon | 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.
|
February 28, 2014 Re: Colons and brackets | ||||
---|---|---|---|---|
| ||||
Posted in reply to evilrat | 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
|
March 01, 2014 Re: Colons and brackets | ||||
---|---|---|---|---|
| ||||
Posted in reply to anonymous | On 2014-02-28 7:53 AM, anonymous wrote:
> nope
nope?
|
March 01, 2014 Re: Colons and brackets | ||||
---|---|---|---|---|
| ||||
Posted in reply to Etienne | 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?
|
March 01, 2014 Re: Colons and brackets | ||||
---|---|---|---|---|
| ||||
Posted in reply to Etienne | 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. |
March 02, 2014 Re: Colons and brackets | ||||
---|---|---|---|---|
| ||||
Posted in reply to anonymous | 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.
|
March 02, 2014 Re: Colons and brackets | ||||
---|---|---|---|---|
| ||||
Posted in reply to evilrat | 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.
|
March 02, 2014 Re: Colons and brackets | ||||
---|---|---|---|---|
| ||||
Posted in reply to evilrat | "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. |
March 02, 2014 Re: Colons and brackets | ||||
---|---|---|---|---|
| ||||
Posted in reply to anonymous | 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..
|
Copyright © 1999-2021 by the D Language Foundation