When you can (legally) observe it, tuples in Swift have guaranteed standard
C-style layout.
John McCall confirms this here:
https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20170424/004481.html
> On 20 Jul 2017, at 4:33 am, Taylor Swift via swift-users
> wrote:
Hi,
> On 20 Jul 2017, at 5:41 pm, Taylor Swift wrote:
>
> Does addressof count as legally observing it?
>
> var buffers:(GL.UInt, GL.UInt) = (0, 0)
> glGenBuffers(n: 2, buffers: )
>
> Also, I assume Swift performs a swizzle if the tuple is defined in a
Hi,
> On 20 Jul 2017, at 7:54 pm, Taylor Swift wrote:
>
> This does not seem to be the case…
>
> var buffers:(VBO:GL.UInt, EBO:GL.UInt) = (0, 0)
> glGenBuffers(n: 2, buffers: )
this is definitely illegal as you're writing 2 GL.UInts and you're giving it a
> On 21 Jul 2017, at 1:45 am, Taylor Swift wrote:
>
> Okay, apparently layout is only guaranteed if the reference is to the tuple
> itself, not a member of the tuple. Don’t know if this is a bug or intended
> behavior. The above code works when written as
>
>
s of closure deeper, before he has access to both struct
> members?
>
> This doesn’t seem to scale very well. What about a struct with 5 arrays?
> --
> Chris McIntyre
>
>
>
>
>> On Sep 21, 2017, at 6:05 AM, Johannes Weiß via swift-users
>> <swift-us
Hi Rick,
> On 21 Sep 2017, at 1:03 am, Rick Mann via swift-users
> wrote:
>
> I've got Swift code wrapping a C API. One of the C structs the API uses looks
> like this:
>
> typedef struct {
>size_t size;
>float transformation[16];
>float projection[16];
>
Hi Fadi,
Just two questions:
- did you compile & run this program on the same machine or not? (the
.swiftmodule files and others are needed for LLDB)
- did you use your Linux distro's lldb or the one that comes with the Swift
toolchain? (you'll need the very LLDB that comes with the Swift
Hi Kelvin,
> On 9 Nov 2017, at 12:30 am, Kelvin Ma wrote:
>
> For context, the problem I’m trying to solve is efficiently parsing JPEG
> chunks. This means reading each chunk of the JPEG from a file into a raw
> buffer pointer, and then parsing the chunk according to its
Hi Kelvin,
> On 8 Nov 2017, at 5:40 pm, Kelvin Ma wrote:
>
> yikes there’s no less verbose way to do that? and if the type isn’t an
> integer there’s no way to avoid the default initialization? Can this be done
> with opaques or something?
well, it's 5 lines for the