Any specific reason why this 1) gives a warning and 2) doesn't give the expected output?
| > add_constant("buh",17); | Compiler Warning: 1: Returning a void expression. Converted to zero. | (4) Result: 0 | > master()->resolv("buh"); | (5) Result: 0
Unrelated issues at least.
add_constant("buh",17);
Compiler Warning: 1: Returning a void expression. Converted to zero. (1) Result: 0
buh;
(2) Result: 17
all_constants()->buh;
(3) Result: 17
sleep(1);
Compiler Warning: 1: Returning a void expression. Converted to zero. (4) Result: 0
Any specific reason why this
- gives a warning
add_constant() returns void, but hilfe doesn't know about that, and assigns the (nonexistant) returned value to something.
and 2) doesn't give the expected output?
resolv() does not perform any lookup in all_constants(). It performs lookups in _static_modules and the module path.
So why can't you no longer return void?
| > void foo() { return add_constant("foo",17); } | Compiler Warning: 1: Returning a void expression. Converted to zero. | Compiler Error: 1: Wrong return type. | Compiler Error: 1: Expected: void. | Compiler Error: 1: Got : zero.
And I assume resolv() is deprecated then, and add_constant() is to be used?
pike-devel@lists.lysator.liu.se