Skip to content

[Needs Verification] §1.7.1 — integer literal typing may differ between decimal and hex/binary/octal notation #52

Description

@NickHodges

Section: §1.7.1 Integer literal typing

Current text:
States integer literals are typed as the smallest of Integer/Cardinal/Int64/UInt64 that fits, uniformly across notations.

Problem:
In practice, Delphi's literal typing may differ by notation: decimal literals that overflow Integer are typed Int64 (not Cardinal), whereas hex/binary/octal literals of the same magnitude can be typed Cardinal since they're read as bit patterns rather than signed magnitudes. This nuance may be missing from the current uniform description.

Why this needs compiler verification:
This project already verifies lexical claims via compiler fixtures (see tests/Fixtures). Test the inferred type of a decimal literal like 3000000000 vs. the hex equivalent $B2D05E00 at a point where the inferred type is observable (e.g. via overload resolution or a type-mismatch error), on both 32-bit and 64-bit targets.

Suggested fix (pending verification):
If confirmed, document the notation-dependent typing distinction; if not confirmed, no change needed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationneeds-compiler-verificationClaim needs verification against the real Delphi compiler before fixing

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions