Skip to content

docs: int is platform width, not always 32-bit - #28876

Open
quaesitor-scientiam wants to merge 2 commits into
vlang:masterfrom
quaesitor-scientiam:docs-int-platform-width
Open

quaesitor-scientiam wants to merge 2 commits into
vlang:masterfrom
quaesitor-scientiam:docs-int-platform-width

Conversation

@quaesitor-scientiam

Copy link
Copy Markdown
Contributor

The Primitive types note in doc/docs.md says:

Unlike C and Go, int is always a 32 bit integer.

That has not been true since #28293 (25f5ced70b), which made int platform width; that commit touched nothing under doc/. Checked against the generated C on master c9b806b294:

v -arch <arch> -o w.c of x := 19 C declaration
amd64 i64 x = 19;
i386 i32 x = 19;

Changes

  1. The note now says int is 64 bits on 64-bit targets and 32 bits on 32-bit targets, and points to i32/i64 for a fixed width.

  2. The raw inline-assembly example used addl on two int operands. Copied as written, it fails under gcc with the same error as Inline assembly tests use 32-bit mnemonic suffixes on platform-int operands, so they fail to assemble under gcc/clang #28870:

    Error: incorrect register `%rax' used with `l' suffix
    

    Its operands are now i32, followed by one sentence explaining why, since this is an easy trap for anyone porting 32-bit inline assembly.

example -cc gcc -cc <bundled tcc>
as written assembler error prints 42
with i32 operands prints 42 prints 42

Checks

  • All changed lines are ≤ 100 characters.
  • v check-md doc/docs.md: 3 errors and 2 formatting errors, at lines 928, 6015 and 8833. Unmodified master reports exactly the same set at 927, 6014 and 8832 (the one-line shift is the longer note), so none come from this change. Both edits are prose or a v ignore block.

🧙 Built with WOZCODE

@quaesitor-scientiam

Copy link
Copy Markdown
Contributor Author

No CI failure on #28876 comes from the PR. All three red checks fail the same way on master and on every other recent PR, including #28873 and #28874, which don't touch any Markdown. There's nothing to fix in this PR.

@JalonSolov

Copy link
Copy Markdown
Collaborator

There are several errors in examples. For instance, https://github.com/vlang/v/actions/runs/35810344048/job/107020291499?pr=28876#step:6:11 is saying that \141 is an invalid number... which is correct.

@quaesitor-scientiam

Copy link
Copy Markdown
Contributor Author

There are several errors in examples. For instance, https://github.com/vlang/v/actions/runs/35810344048/job/107020291499?pr=28876#step:6:11 is saying that \141 is an invalid number... which is correct.

docs.md:927/:8832 on master been broken since 2026-08-21

To make it green again will require researching a separate fix

@quaesitor-scientiam

Copy link
Copy Markdown
Contributor Author

You're right — both are real failures, and my date above was wrong: 2026-08-21 is only when master's Docs CI last passed. The two examples broke later, one day apart:

With both merged, check-markdown should be back to green (apart from anything newer).

@JalonSolov

Copy link
Copy Markdown
Collaborator

Now that #28882 has been merged, try merging master here to ensure the fix took care of things.

@quaesitor-scientiam

Copy link
Copy Markdown
Contributor Author

If no further issues can this be merged

@JalonSolov

Copy link
Copy Markdown
Collaborator

See my comment just before yours.

PythonWillRule and others added 2 commits September 24, 2026 13:10
Since vlang#28293 (25f5ced) `int` lowers to `i64` on 64-bit targets and to
`i32` on 32-bit ones, but the Primitive types note still said "Unlike C
and Go, `int` is always a 32 bit integer".

The raw inline-assembly example had the same stale assumption: it used
`addl` on two `int` operands, which fails under gcc with "incorrect
register `%rax' used with `l' suffix" (the same problem as vlang#28870). Its
operands are now `i32`, with a sentence on why.

Co-Authored-By: WOZCODE <contact@withwoz.com>
55d43d2 rejects `sql` as a parameter name, so the "Calling C from
V" SQLite example no longer compiled:

    error: unexpected keyword `sql`, expecting name

That is one of the two examples that make `check-markdown` fail on
master. Rename the parameter of `C.sqlite3_exec` to `query`.

Co-Authored-By: WOZCODE <contact@withwoz.com>
@quaesitor-scientiam

Copy link
Copy Markdown
Contributor Author

Now that #28882 has been merged, try merging master here to ensure the fix took care of things.

Rebased with master CI jobs running

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants