in reply to Re: Use of uninitialized value in substr
in thread Use of uninitialized value in substr
since the compiler does flip warning bits
I know it's off topic, but could you give an example of where the compiler flips warning bits or suppresses a warnings? I can't think of any.
Sometimes it does
undef() never gives a warning in void context. It's not an example of the compiler messing with the warning bits. It probably should warn if it's in void context and has no args, but it has nothing to do with flipping warning bits. The current implementation probably can't handle the "and has no args" part trivially.
An explicit undef is seen by the compiler, and since the compiler does flip warning bits, it should do that for explicit undef.
Your suggested implementation wouldn't work for a number of reasons (substr is already compiled. substr has more than one argument and the warning bits apply to all of them), but it doesn't mean it's not possible. In fact, I think it's quite easy to implement by having the parser convert undef to '' (like it converts while (<>) to while (defined($_ = <>))).
|
|---|