Skip to content

Please document that an empty slice is null #430

@rrthomas

Description

@rrthomas

Describe the bug

The documentation of array slices doesn't point out that if you take a slice of an empty array of built-in type (for example uint8[]), the result is null. I assume this is correct behaviour and not a bug in the language! I see that this won't happen in general; for example, string.slice uses strndup, which will only return null on error; but I guess it will happen for slices of arrays of built-in types. Or at least, can happen; in my experiments, the data member of the array was null.

https://docs.vala.dev/tutorials/programming-language/main/02-00-basics/02-04-data-types.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions