B-C

 view release on metacpan or  search on metacpan

lib/B/CC.pm  view on Meta::CPAN

L<http://blogs.perl.org/users/rurban/2011/02/use-types.html>

=head1 BUGS

Plenty. Current status: experimental.

=head1 DIFFERENCES

These aren't really bugs but they are constructs which are heavily
tied to perl's compile-and-go implementation and with which this
compiler backend cannot cope.

=head2 Loops

Standard perl calculates the target of "next", "last", and "redo"
at run-time. The compiler calculates the targets at compile-time.
For example, the program

    sub skip_on_odd { next NUMBER if $_[0] % 2 }
    NUMBER: for ($i = 0; $i < 5; $i++) {
        skip_on_odd($i);
        print $i;
    }

produces the output

    024

with standard perl but calculates with the compiler the
goto label_NUMBER wrong, producing 01234.

=head2 Context of ".."

The context (scalar or array) of the ".." operator determines whether
it behaves as a range or a flip/flop. Standard perl delays until
runtime the decision of which context it is in but the compiler needs
to know the context at compile-time. For example,

    @a = (4,6,1,0,0,1);
    sub range { (shift @a)..(shift @a) }
    print range();
    while (@a) { print scalar(range()) }

generates the output

    456123E0

with standard Perl but gives a run-time warning with compiled Perl.

If the option B<-strict> is used it gives a compile-time error.

=head2 Arithmetic

Compiled Perl programs use native C arithmetic much more frequently
than standard perl. Operations on large numbers or on boundary
cases may produce different behaviour.
In doubt B::CC code behaves more like with C<use integer>.

=head2 Deprecated features

Features of standard perl such as C<$[> which have been deprecated
in standard perl since Perl5 was released have not been implemented
in the optimizing compiler.

=head1 AUTHORS

Malcolm Beattie C<MICB at cpan.org> I<(1996-1998, retired)>,
Vishal Bhatia <vishal at deja.com> I(1999),
Gurusamy Sarathy <gsar at cpan.org> I(1998-2001),
Reini Urban C<perl-compiler at googlegroups.com> I(2008-now),
Heinz Knutzen C<heinz.knutzen at gmx.de> I(2010)
Will Braswell C<wbraswell at hush.com> I(2012)

=cut

# Local Variables:
#   mode: cperl
#   cperl-indent-level: 2
#   fill-column: 78
# End:
# vim: expandtab shiftwidth=2:



( run in 2.320 seconds using v1.01-cache-2.11-cpan-804bf51f3ce )