Skip to content

@Type(@typeInfo(c_int)) != c_int #14650

Description

@DerryAlex

Zig Version

0.11.0-dev.1580+a5b34a61a

Steps to Reproduce and Observed Behavior

const std = @import("std");

pub fn main() void {
    const Cint = @Type(@typeInfo(c_int));
    std.log.info("{} {} {}", .{ c_int == i32, Cint == c_int, Cint == i32 });
}

on linux amd64:

info: false false true

Expected Behavior

Not sure if this is intended. It is quite confusing.

  1. If this is intended, it should be documented.
  2. Or c_int and i32 has different internal type id, but c_int == i32 holds on amd64 targets and c_int == i16 holds on some embedded targets.

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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions