On Thursday, 16 September 2021 at 18:02:44 UTC, Steven
Schveighoffer wrote:
Are you sure? Be very pedantic about what C functions do with
the data you send it. Sometimes they store it somewhere to use
later. Sometimes they expect it to be allocated by the C heap,
etc.
Without seeing how you use it, I can't tell you if it's wrong
or not.
If you want to have a look the original C-library is here
https://github.com/rdoeffinger/iec16022
I'm only using the encoder function iec16022ecc200f.
If it's a literal, you don't need to toStringz (which also
allocates). All string literals are zero-terminated (and
actually implicitly castable to `immutable char *`).
-Steve
Thanks, I'm just careful with casting.
Does it really allocate from a literal if it's used on the stack
only? Is `-vgc` switch reliable?