Ok, omitting the last input appears to be acceptable.
$ perl -wE'say length pack "sslli", 0, 0, 0, 0;'
16
$ perl -wE'say length pack "sslli", 0, 0, 0, 0, 0;'
16
However, that's far shorter than expected, at least on the 64-bit system I used.
$ cat a.c
#include <fcntl.h>
#include <stddef.h>
#include <stdio.h>
int main() {
struct flock lock;
printf("flock: %lu\n", sizeof(lock));
printf("flock.l_type: %lu @ %2lu\n", sizeof(lock.l_type ), offse
+tof(struct flock, l_type ));
printf("flock.l_whence: %lu @ %2lu\n", sizeof(lock.l_whence), offse
+tof(struct flock, l_whence));
printf("flock.l_start: %lu @ %2lu\n", sizeof(lock.l_start ), offse
+tof(struct flock, l_start ));
printf("flock.l_len: %lu @ %2lu\n", sizeof(lock.l_len ), offse
+tof(struct flock, l_len ));
printf("flock.l_pid: %lu @ %2lu\n", sizeof(lock.l_pid ), offse
+tof(struct flock, l_pid ));
return 0;
}
$ gcc -Wall a.c -o a && a
flock: 32
flock.l_type: 2 @ 0
flock.l_whence: 2 @ 2
flock.l_start: 8 @ 8
flock.l_len: 8 @ 16
flock.l_pid: 4 @ 24
On that system, one would need
$ perl -wE'say length pack "s s x4 q q L x4", 0, 0, 0, 0, 0;'
32
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.