Skip to content

Zero Sized Strings #878

@Kronos3

Description

@Kronos3

In the spec https://nasa.github.io/fpp/fpp-spec.html#Type-Names_String-Type-Names it says that string sizes must be in the range [0, 2^31), the wiki agrees with this.

The implementation doesn't allow 0:

if (size > 0 && size <= Int.MaxValue) Right(t)
else {
val loc = Locations.get(id)
Left(SemanticError.InvalidStringSize(loc, size))
}

Not really sure what the implications of string size 0 are but presumably it could be useful if the string size configuredConstant use case is used and you want to disable a field? We should test to make sure compilation works with string size 0 without any warnings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    specIssues related to the FPP language specification

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions