tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Kristaps Dzonsons <kristaps@bsd.lv>
To: espie@nerim.net
Cc: tech@mdocml.bsd.lv
Subject: Re: mandocdb tools, sqlite3, and ohash
Date: Fri, 08 Jun 2012 14:05:55 +0200	[thread overview]
Message-ID: <4FD1EAA3.7060306@bsd.lv> (raw)
In-Reply-To: <20120607165106.GA8819@lain.home>

On 06/07/12 18:51, Marc Espie wrote:
> On Thu, Jun 07, 2012 at 05:15:24PM +0200, Kristaps Dzonsons wrote:
>>    struct  str {
>>          ...stuff here...
>>          char key[1];
>>    };
>>
>> ...with allocation in the regular way (the struct size plus the
>> string length).  Is this known to play nicely with all compilers?  I
>> can't think of a better way without modifying the ohash routines to
>> work with key pointers.
>
> Yes, it will "work".
> All old compilers I know will accept it,
> and it has been formally normalized in C99, with a slightly different
> syntax.
>
> Refer to 6.7.2.1 16
> It talks about flexible array members.
>
> For C99, the syntax should be
>
> struct str {
> 	...
> 	char key[];
> };
>
> and obviously, the length is smaller by one.
>
> as far as I know, all compilers do still accept the former syntax and will
> work just fine on all architectures that matter.

Marc,

Thanks for the note.  I'll use the C99 approach and will add the 
necessary bits if people complain.

Best,

Kristaps
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

      parent reply	other threads:[~2012-06-08 12:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-07 15:15 Kristaps Dzonsons
2012-06-07 16:29 ` Joerg Sonnenberger
2012-06-07 18:06 ` Ingo Schwarze
2012-06-08 10:29   ` Kristaps Dzonsons
2012-06-08 12:25     ` Joerg Sonnenberger
2012-06-08 13:38       ` Kristaps Dzonsons
2012-06-08 14:13         ` Joerg Sonnenberger
     [not found] ` <20120607165106.GA8819@lain.home>
2012-06-08 12:05   ` Kristaps Dzonsons [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FD1EAA3.7060306@bsd.lv \
    --to=kristaps@bsd.lv \
    --cc=espie@nerim.net \
    --cc=tech@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).