www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Different function attributes between debug and release build

reply Lodovico Giaretta <lodovico giaretart.net> writes:
Currently, std.string.assumeUTF is inferred  nogc in release 
mode, while in debug mode it isn't. Should this be allowed?
It can cause some problems, e.g. I have some  nogc unittests that 
I use to guarantee that my code is in fact  nogc, and these fail 
because in debug mode assumeUTF is not.
In general (IMHO) this kind of difference should be avoided, 
because code should not change meaning between debug and release 
modes.

What do you think?
Jul 07 2016
parent reply Jerry <Kickupx gmail.com> writes:
On Thursday, 7 July 2016 at 19:39:12 UTC, Lodovico Giaretta wrote:
 Currently, std.string.assumeUTF is inferred  nogc in release 
 mode, while in debug mode it isn't. Should this be allowed?
 It can cause some problems, e.g. I have some  nogc unittests 
 that I use to guarantee that my code is in fact  nogc, and 
 these fail because in debug mode assumeUTF is not.
 In general (IMHO) this kind of difference should be avoided, 
 because code should not change meaning between debug and 
 release modes.

 What do you think?
That is definetly a bug.
Jul 08 2016
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 7/8/2016 1:04 PM, Jerry wrote:
 On Thursday, 7 July 2016 at 19:39:12 UTC, Lodovico Giaretta wrote:
 Currently, std.string.assumeUTF is inferred  nogc in release mode, while in
 debug mode it isn't. Should this be allowed?
 It can cause some problems, e.g. I have some  nogc unittests that I use to
 guarantee that my code is in fact  nogc, and these fail because in debug mode
 assumeUTF is not.
 In general (IMHO) this kind of difference should be avoided, because code
 should not change meaning between debug and release modes.

 What do you think?
That is definetly a bug.
Not a bug until it is posted to Bugzilla!
Jul 08 2016
next sibling parent ketmar <ketmar ketmar.no-ip.org> writes:
On Saturday, 9 July 2016 at 01:05:54 UTC, Walter Bright wrote:
 Not a bug until it is posted to Bugzilla!
so if i won't post a dmd segfault there, i may assume that dmd segfault is intended behavior? then let's document it! ;-)
Jul 08 2016
prev sibling parent Lodovico Giaretta <lodovico giaretart.net> writes:
On Saturday, 9 July 2016 at 01:05:54 UTC, Walter Bright wrote:
 On 7/8/2016 1:04 PM, Jerry wrote:
 That is definetly a bug.
Not a bug until it is posted to Bugzilla!
Well, I didn't post it there directly because I wasn't sure it could be considered a bug. The reason it is not nogc in debug mode is that it performs extra checks that may throw exceptions (so I guess it isn't nothrow either), which isn't bad per se, but makes it difficult to verify (using unittest) that code using it is nogc.
Jul 09 2016