I wrote an AR archive (.a files) parser in D
Renato Athaydes
renato at athaydes.com
Thu Aug 8 10:55:49 UTC 2024
On Thursday, 8 August 2024 at 10:44:49 UTC, Renato Athaydes wrote:
> On Tuesday, 6 August 2024 at 14:55:50 UTC, IchorDev wrote:
>> On Sunday, 4 August 2024 at 20:14:50 UTC, Renato wrote:
>>> Just announcing here in case someone may be interested in
>>> that (the code is very easy to read) and wants to give some
>>> feedback on my usage of D
>>
>> Second, do not cast from `const(ubyte[])` to `string`
>
I supposed this is the code bothering you?
auto file = (cast(string) input[0 .. 16]).strip;
I do want a `string` there, but I think you're saying that
because `input` had a `in` attribute, it "may" be mutable via
another reference.
I agree with that, specially when the "default" implementation
get the bytes from a memory-mapped file. What's the best solution
in this case, to dup the bytes and then cast to `string`?
Or you mean I can't even use `string` at all in this case, and
therefore can't use functions like `std.string : strip,
startsWith`?
More information about the Digitalmars-d
mailing list