Skip to content

Arrays in boolean context should check .length not .ptr #64

Description

@wilzbach

Dynamic array variables in boolean context (e.g. when encountered in an if condition by themselves) are considered equivalent to their .ptr property. It has been argued they should instead use their .length property, so that empty (but not null) arrays evaluate as false. See Issue 4733 - Possible bugs caused by dynamic arrays in boolean evaluation context and related pull requests.

(from: https://wiki.dlang.org/Language_issues)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions