Re: void[] vs ubyte[] - differences?

2025-07-17 Thread Dukc via Digitalmars-d-learn
On Wednesday, 16 July 2025 at 13:29:01 UTC, z wrote: I also see this in the language documentation : ``` A void array cannot be indexed. ``` But i can slice it just fine in DMD 2.111... You can _slice_ it, meaning, getting a subarray out of it. However, _indexing_ means getting a single elemen

Re: void[] vs ubyte[] - differences?

2025-07-17 Thread Nick Treleaven via Digitalmars-d-learn
On Thursday, 17 July 2025 at 16:26:43 UTC, Nick Treleaven wrote: Perhaps there should be an entry for `void` in the types page. A `void` value cannot be accessed. `void.sizeof` is 1 so that a void array can have length equivalent to the number of bytes in the array. https://github.com/dlang/d

Re: void[] vs ubyte[] - differences?

2025-07-17 Thread Nick Treleaven via Digitalmars-d-learn
On Wednesday, 16 July 2025 at 13:29:01 UTC, z wrote: I also see this in the language documentation : ``` A void array cannot be indexed. ``` But i can slice it just fine in DMD 2.111... Is this by design or is there a hole in the language specification? The sentence before says: Array indice