From ttm|gue|tt @end|ng |rom gm@||@com  Tue Apr  4 11:27:03 2023
From: ttm|gue|tt @end|ng |rom gm@||@com (Michael Milton)
Date: Tue, 4 Apr 2023 19:27:03 +1000
Subject: [Rd] Breaking Change in Rcomplex Layout?
In-Reply-To: <20230404105015.2a1a65fa@Tarkus>
References: <CAPZyOoLG7Bgt0D_Nz-pdBv5k0_SmpFN9UuFE1-mKQxX76L=21g@mail.gmail.com>
 <e8c052d6-50ae-002d-71ba-5e160b56d419@gmail.com>
 <CAPZyOoL7rLbLHwQMziADwg_Dy-UGNScdwi3wf_RawWyU2Y4v-Q@mail.gmail.com>
 <c90c269e-1fdd-b12d-263c-e8c4a92e08db@gmail.com>
 <CAPZyOo++tZ-ThaGq=Zj3HbiY-r3wH3x0jPOHKgWcJ9zU-FTYLA@mail.gmail.com>
 <3787c02c-2f7a-96b7-3299-35734db89a0f@gmail.com>
 <20230404105015.2a1a65fa@Tarkus>
Message-ID: <CAPZyOoKxTKu20CCiVXZ2yCiUxZYPj0=MfM8bKDLJkNsMPU3Vag@mail.gmail.com>

I don't think an auto-generated name (along the lines of u or u2) for the
anonymous structs would be helpful here. You can see that bindgen is
already generating a placeholder name ("__bindgen_anon_1"). A meaningful
name might be nice instead, but I get the impression that isn't an option
here since that would break the C API.

Can I ask, would it make sense for us to hard code in R_LEGACY_RCOMPLEX so
that Rust can just ignore the union? Because as I understand the only
compiler that actually needs to "see" the union is gfortran, and if we
pretend it's still a struct in Rust everything should work as before, no?
Is this guaranteed to be a stable macro?

On Tue, Apr 4, 2023 at 5:50?PM Ivan Krylov <krylov.r00t at gmail.com> wrote:

> On Tue, 4 Apr 2023 09:31:33 +0200
> Tomas Kalibera <tomas.kalibera at gmail.com> wrote:
>
> > it also matters how Rust can handle anonymous nested structures, or
> > what is the right mapping of the involved C types to Rust
>
> It's worth mentioning that Rust's RFC 2102 [1] defines unnamed structs
> and unions for the purpose of C interoperability, but it's not yet
> implemented.
>
> Would it help Rust's bindgen (and, potentially, other C declaration
> parsers) if R could optionally give a name to the anonymous union
> member, like it's done in Windows API [2]?
>
> --
> Best regards,
> Ivan
>
> [1] https://github.com/rust-lang/rust/issues/49804
>
> [2] https://devblogs.microsoft.com/oldnewthing/20170907-00/?p=96956
>

	[[alternative HTML version deleted]]



[Rd] Breaking Change in Rcomplex Layout?
Michael Milton