diff options
author | Chip Salzenberg <chip@atlantic.net> | 1997-01-08 11:52:00 +1200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-01-08 11:52:00 +1200 |
commit | 4cee8e801dff327aea080085070903d41783ea55 (patch) | |
tree | 5fa96bad50128892599acd4b04a9960e098837cb /pod/perlsub.pod | |
parent | a4165598218d6f4027c60d743c1ec7eb33232258 (diff) | |
download | perl-4cee8e801dff327aea080085070903d41783ea55.tar.gz |
Re: constant function inlining
(this is the same change as commit f0893e72a8aa916a77953ff2f1847494d1527fb8, but as applied)
Diffstat (limited to 'pod/perlsub.pod')
-rw-r--r-- | pod/perlsub.pod | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pod/perlsub.pod b/pod/perlsub.pod index 6bd3fe8d84..bd3eb18154 100644 --- a/pod/perlsub.pod +++ b/pod/perlsub.pod @@ -754,6 +754,21 @@ starts scribbling on your @_ parameter list. This is all very powerful, of course, and should be used only in moderation to make the world a better place. +If you redefine a subroutine which was eligible for inlining you'll get +a mandatory warning. (You can use this warning to tell whether or not a +particular subroutine is considered constant.) The warning is +considered severe enough not to be optional because previously compiled +invocations of the function will still be using the old value of the +function. If you need to be able to redefine the subroutine you need to +ensure that it isn't inlined, either by dropping the C<()> prototype +(which changes the calling semantics, so beware) or by thwarting the +inlining mechanism in some other way, such as + + my $dummy; + sub not_inlined () { + $dummy || 23 + } + =head2 Overriding Builtin Functions Many builtin functions may be overridden, though this should be tried |