This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE pack/unpack C-like enhancements =head1 VERSION Maintainer: Ilya Zakharevich <[EMAIL PROTECTED]> Date: 16 September 2000 Mailing List: [EMAIL PROTECTED] Number: 247 Version: 1 Status: Developing =head1 ABSTRACT This RFC proposes C-like syntactic sugar to templates of pack/unpack. =head1 DESCRIPTION An alternative style of type specifiers is allowed in pack()/unpack() TEMPLATEs. This style is used in the parts of the TEMPLATE enclosed in braces, as in C<'{ C_STYLE_TEMPLATE }'>. Optionally, if TEMPLATE starts with C<'struct {'> (with possible intervening whitespace and comments) C<struct> is ignored. When this style is in scope, then =over 8 =item * the counts of the form C<32> are prohibited, use C<[32]> instead; =item * C<struct {TEMPLATE}> should be used instead of C<(TEMPLATE)> for grouping; =item * instead of one-char type specifiers, the corresponding C-like specifiers C<int>/C<char>/C<short>/C<long>/C<long long> should be used. They may be preceeded by C<unsigned>/C<signed>/C<native>/C<little-endian>/C<big-endian>, (C<native> being the default). The type C<string> should be used instead of C<a>, with modifiers C<byte>/C<utf8> if needed. C<ignore> may be used to replace C<'x'>. C<aligh(LEN)> may be used as a prefix to replace C<'x!LEN'>; =item * C<I8>/C<I16>/C<I32>/C<U8>/C<U16>/C<U32> can be used too; =item * C9X syntax C<int_8> (sp?) etc. can be used too; =item * C<[]> should be used instead of C<*>, as in C<'{ int[4]; short[] }'>; =item * if a type is put inside C<[]>, it should start with C<sizeof>, as in C<'{ string[ sizeof long ] }'> which is equivalent to C<a[L]>. =back =head1 MIGRATION ISSUES None. =head1 IMPLEMENTATION Straightforward. =head1 REFERENCES RFC 142: Enhanced Pack/Unpack RFC 246: pack/unpack uncontrovercial enhancements