Is the D community lacking development tools?
Artur Skawina
art.08.09 at gmail.com
Fri May 25 13:07:12 PDT 2012
On 05/25/12 21:36, Jonathan M Davis wrote:
> On Friday, May 25, 2012 13:52:05 simendsjo wrote:
>> Couldn't dmd automatically add an assert(c) in debug mode before accessing
>> members?
>
> That's been argued for ages. Walter is against it, because the OS already
> takes care of it with segfaults. you can either run the program again (which
> isn't necessarily true, but I believe with the programs that he seems to run
> normally, it is, so he's got somewhat of a skewed perspective on that), or if
> you have core dumps enabled, you can just examine the core dump to see what
> happened. Also, adding all of those assertions would also negatively impact
> non-release mode - and possibly by quite a bit, since it would be happening
> all over the place, so there's that to consider.
>
> Regardless, it's a rather devisive subject. I think that _most_ people would
> like to have such assertions added in non-release mode, but since Walter's
> against it, it's never happened.
It's bad enough that such check is forced by the compiler in non-release mode
when calling methods. That means you get to choose between not supporting
non-release builds at all, or having an awkward, unnatural API, for no other
reason than this compiler limitation.
Checking for non-null refs/pointers before accessing members would actually
be less problematic, as dereferencing null is *always* a bug, unlike the
method case, where it can be perfectly fine.
Tuning this behavior on a per-type basis via attributes would be best, but
that's not likely to happen soon, i guess.
artur
More information about the Digitalmars-d
mailing list