Skip to content

introduce operating system version ranges as part of the target #1907

Closed
@andrewrk

Description

@andrewrk

On Linux we have kernel versions: 3.14, 4.14, 4.18, etc.

On Windows we have versions, e.g.

  • XP
  • Vista
  • 7
  • 8
  • 10

FreeBSD has the concept of versions: most recent e.g. 12.0

MacOS / iOS has the concept of versions too - e.g. 10.14.3

I propose for OS minimum version and maximum version to be part of the target. When you specify an OS minimum version as part of the target, it is telling userland code what ABI it can rely on. Each OS will have a default minimum version. Some standard library functions (or functions from third party packages) may give a @compileError("this API supported only on OS version xyz and later"). The OS minimum version will be available for userland code to observe in @import("builtin").

Maximum version is also useful, because it can avoid code bloat, when it is compile-time known that the code will not be able to take advantage of newer OS features.

When compiling for the native target, the minimum and maximum OS versions will be the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThis proposal is planned.contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions