On 2018-05-18 14:42:17 +0000, Adam D. Ruppe said:

On Friday, 18 May 2018 at 14:06:11 UTC, Robert M. Münch wrote:
So, having a wrong return-type here, resulted in the const char *text parameter always being NULL. Not sure I understand the relation but looks strange to me... at least not very obvious.

A value struct return is actually done via a hidden pointer parameter (so the function can construct it in-place for the caller, a standard optimization), so it just shifted all the other arguments to the side, causing one of those 0's to be interpreted as the string.

Wow, thanks for the clear explanation. Without very deep internal knowhow I don't think anyone is able to ever guess this.

Is this somehwere documented?

--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster

Reply via email to