develooper Front page | perl.perl5.porters | Postings from May 2013

pack() for producing C structs (Was: Re: How on earth did we manageto break pack() so badly?)

Thread Previous | Thread Next
From:
Steffen Mueller
Date:
May 1, 2013 16:53
Subject:
pack() for producing C structs (Was: Re: How on earth did we manageto break pack() so badly?)
Message ID:
5181487C.4070004@steffen-mueller.net
[side-track]

On 05/01/2013 06:44 PM, demerphq wrote:
> My understanding of pack()s original intention was to allow one to
> construct C structures in Perl. As such introduces a change which
> basically means one cannot safely put a string into a C structure
> without the possibility of the entire structure being corrupted by
> doing so doesn't make sense.

In all fairness, if you use pack to do that, you'll be writing VERY 
unportable code due to alignment, padding and friends. But don't listen 
to me: Have a look at the docs for Convert::Binary::C. Marcus knows a 
lot better than I do.

--Steffen

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About