October 06, 2012
On Saturday, October 06, 2012 20:42:01 Alex Rønne Petersen wrote:
> version (assert) is a very recent addition to the compiler and is not in
> 2.060.

Which would probably explain why it's not working for him, since presumably, he's not building the compiler himself, but then it really shouldn't be up on the website yet.

- Jonathan M Davis
October 06, 2012
On Saturday, 6 October 2012 at 19:16:26 UTC, Jonathan M Davis wrote:
> On Saturday, October 06, 2012 20:42:01 Alex Rønne Petersen wrote:
>> version (assert) is a very recent addition to the compiler and is not in
>> 2.060.
>
> Which would probably explain why it's not working for him, since presumably,
> he's not building the compiler himself, but then it really shouldn't be up on
> the website yet.
>
> - Jonathan M Davis

I am on dmd 2.060

debug {} else {} was not obvious for me - I thought that debug is a kind of qualifer.
October 07, 2012
On Saturday, October 06, 2012 23:49:23 denizzzka wrote:
> I am on dmd 2.060
> 
> debug {} else {} was not obvious for me - I thought that debug is a kind of qualifer.

I wouldn't expect you to try either version(debug) or debug {} without seeing them in the docs or in TDPL. I suppose that I can see why you would try version(debug), but it's not listed in the docs.

There isn't really a debug version of anything in D. What debug {} does is it's compiled in when -debug is compiled in, and that can be used in conjunction with -release if you want to. So talking about debug vs release in D is likely to get very confusing. Rather -debug enables debug blocks which are intended for inserting debug code, _not_ code which is meant for non- release builds.

It looks like version(assert) (which I guess is only in the github version right now) will effectively correspond to not having -release, but if there's ever a compiler flag which specifically enables or disables assertions instead of -release (which does more than just disable assertions - e.g. it disables bounds checking in non-@safe code), then it won't actually be guaranteed to not be there if -release isn't there. It's close enough though I guess, particularly when the type of stuff that you specifically do in non-release code is typically the kind of stuff that you want done with assertions are enabled and probably wouldn't want enable if assertions were turned off, even if that were to somehow happen without -release.

In any case, -debug and debug{} should be explained in the docs somewhere. It's certainly not the sort of thing that I would expect you to magically know.

- Jonathan M Davis
October 07, 2012
On Sunday, 7 October 2012 at 01:20:49 UTC, Jonathan M Davis wrote:
> On Saturday, October 06, 2012 23:49:23 denizzzka wrote:
>> I am on dmd 2.060
>> 
>> debug {} else {} was not obvious for me - I thought that debug is
>> a kind of qualifer.
>
> I wouldn't expect you to try either version(debug) or debug {} without seeing
> them in the docs or in TDPL. I suppose that I can see why you would try
> version(debug), but it's not listed in the docs.
>
> There isn't really a debug version of anything in D. What debug {} does is
> it's compiled in when -debug is compiled in, and that can be used in
> conjunction with -release if you want to. So talking about debug vs release in
> D is likely to get very confusing. Rather -debug enables debug blocks which
> are intended for inserting debug code, _not_ code which is meant for non-
> release builds.
>
> It looks like version(assert) (which I guess is only in the github version
> right now) will effectively correspond to not having -release, but if there's
> ever a compiler flag which specifically enables or disables assertions instead
> of -release (which does more than just disable assertions - e.g. it disables
> bounds checking in non-@safe code), then it won't actually be guaranteed to
> not be there if -release isn't there. It's close enough though I guess,
> particularly when the type of stuff that you specifically do in non-release code
> is typically the kind of stuff that you want done with assertions are enabled
> and probably wouldn't want enable if assertions were turned off, even if that
> were to somehow happen without -release.


I've got a situation that debug information should be placed into the class via the constructor. Therefore, when used -debug constructor has another arguments list, and its need debug {} else {} for ctor calling.


> In any case, -debug and debug{} should be explained in the docs somewhere.
> It's certainly not the sort of thing that I would expect you to magically
> know.

Yes.

October 07, 2012
On Sunday, October 07, 2012 09:27:31 denizzzka wrote:
> I've got a situation that debug information should be placed into the class via the constructor. Therefore, when used -debug constructor has another arguments list, and its need debug {} else {} for ctor calling.

Which is fine. It's just that you need to realize that debug blocks are enabled with -debug and have nothing to do with whether -release is used or not, so it doesn't correspond with what people typically mean when they talk about debug mode and release mode.

- Jonathan M Davis
1 2
Next ›   Last »