Well, the weirdnesses keep popping up as I write this program... :-)
Pike v7.8 release 473 running Hilfe v3.5 (Incremental Pike Frontend)
int z; sscanf("HOPP", "%*s%n", z);
(1) Result: 2
z;
(2) Result: 4
"HEJHOPP"[3..];
(3) Result: "HOPP"
sscanf("HEJHOPP"[3..], "%*s%n", z);
(4) Result: 2
z;
(5) Result: 7
Surely the result of sscanf("HOPP", ... should be the same regardless of how I compute the value "HOPP"?
The problem is probably due to the optimizer rule for F_SSCANF in treeopt.in:
// sscanf(s[A..], "xxxx", ...) // // => // // (sscanf(s, "%*" + A + "s" + "xxxx", ...) || 1) - 1
Which seems to be sound as long as you don't use %n...
Thanks.
Although I have to say there are a lot of commits on the form "Merge branch 'maint/X' into X", considering we agreed not to do exactly that. Twice, in fact... Rebase, don't merge. Please!
pike-devel@lists.lysator.liu.se