Front page | perl.perl5.porters |
Postings from September 2016
Re: hv.h hek definition
Thread Previous
|
Thread Next
From:
Father Chrysostomos
Date:
September 29, 2016 03:27
Subject:
Re: hv.h hek definition
Message ID:
20160929032720.3005.qmail@lists-nntp.develooper.com
Todd Rinaldo wrote:
> IMO, the declaration for hek_key is VERY misleading. In the context of a
> struct, what you end up with when you do char hek_key[1]; is a char
> pointer followed by a char.
char hek_key[1] stores the char array's members directly in the
struct. There is no pointer stored in the struct.
> This seems
> much more intuitive and legible:
>
> struct hek
> {
> U32 hek_hash; /* hash of key */
> I32 hek_len; /* length of hash key */
> char *hek_key; /* hash key pointer */
> char flags; /* hek flags such as whether the key is UTF-8 */
> };
That variant does store a pointer in the struct and would require the
key to be allocated as a separate buffer.
Thread Previous
|
Thread Next