Thread truncate (11 answers)
Opened by Froschpopo at 2005-11-07 20:59

pq
 2005-11-08 13:17
#59876 #59876
User since
2003-08-04
12209 Artikel
Admin1
[Homepage]
user image
[quote=Froschpopo,08.11.2005, 11:04]könnte man SEEK_SET nicht theoretisch auch selbst schreiben?
z.B. so:
Code: (dl )
sub SEEK_SET { 1 }

???[/quote]
Quote
      In the current implementation, scalar constants are actually inlinable
      subroutines. As of version 5.004 of Perl, the appropriate scalar con-
      stant is inserted directly in place of some subroutine calls, thereby
      saving the overhead of a subroutine call
. See "Constant Functions" in
      perlsub for details about how and when this happens.

außerdem hast du den prototyp () vergessen. vergleiche:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
tina@lugosi:~$ perl -MO=Deparse -e' sub BLA { 23 } print BLA'
sub BLA {
   23;
}
print BLA();
-e syntax OK
tina@lugosi:~$ perl -MO=Deparse -e' sub BLA() { 23 } print BLA'
sub BLA () { 23 }
print 23;
-e syntax OK

somit ist deine "konstante" vermutlich noch langsamer als die von Fcntl.\n\n

<!--EDIT|pq|1131448731-->
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread truncate