Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / c9 / 8beeefb8324ddb3cefb00e5dcaf93dcf348c0d
1 Return-Path: <tomi.ollila@iki.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 5A12E429E32\r
6         for <notmuch@notmuchmail.org>; Thu, 24 Oct 2013 03:19:39 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id DARjGxw-64Yz for <notmuch@notmuchmail.org>;\r
16         Thu, 24 Oct 2013 03:19:31 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 933BB429E29\r
19         for <notmuch@notmuchmail.org>; Thu, 24 Oct 2013 03:19:31 -0700 (PDT)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 2CFBD100217;\r
22         Thu, 24 Oct 2013 13:19:22 +0300 (EEST)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: David Bremner <david@tethera.net>, Austin Clements <amdragon@MIT.EDU>\r
25 Subject: Re: [PATCH 1/3] cli: add insert --must-index option\r
26 In-Reply-To: <87ob6fv8he.fsf@zancas.localnet>\r
27 References: <1374365254-13227-1-git-send-email-novalazy@gmail.com>\r
28         <87ip048gbj.fsf@qmul.ac.uk>\r
29         <20130727151510.GA13750@hili.localdomain>\r
30         <87hadtxfrr.fsf@qmul.ac.uk>\r
31         <20130912001349.GA18821@hili.localdomain>\r
32         <87zjqhv264.fsf@zancas.localnet>\r
33         <m238o9fguj.fsf@guru.guru-group.fi> <87bo2xtdp2.fsf@unb.ca>\r
34         <m2eh7bu7t5.fsf@guru.guru-group.fi>\r
35         <20131023193209.GF20337@mit.edu> <87ob6fv8he.fsf@zancas.localnet>\r
36 User-Agent: Notmuch/0.16+115~g11c2ff5 (http://notmuchmail.org) Emacs/24.3.1\r
37         (x86_64-unknown-linux-gnu)\r
38 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
39         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
40         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
41 Date: Thu, 24 Oct 2013 13:19:22 +0300\r
42 Message-ID: <m27gd3q8d1.fsf@guru.guru-group.fi>\r
43 MIME-Version: 1.0\r
44 Content-Type: text/plain\r
45 Cc: notmuch@notmuchmail.org\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Thu, 24 Oct 2013 10:19:39 -0000\r
59 \r
60 On Thu, Oct 24 2013, David Bremner <david@tethera.net> wrote:\r
61 \r
62 > Austin Clements <amdragon@MIT.EDU> writes:\r
63 >\r
64 >> And in libnotmuch, we would do something like\r
65 >>\r
66 >> notmuch_status_t\r
67 >> notmuch_database_open (const char *path,\r
68 >>                        notmuch_database_mode_t mode,\r
69 >>                        const notmuch_options_t *options,\r
70 >>                        notmuch_database_t **database)\r
71 >> {\r
72 >>     notmuch_option_t real_options = NOTMUCH_OPTIONS_INIT;\r
73 >>     if (real_options.options_length < options.options_length)\r
74 >>         return error;\r
75 >>     memmove(&real_options, options, options.options_length);\r
76 >>     // ...\r
77 >> }\r
78 >>\r
79 >\r
80 > Does the C standard guarantee that if two structs have the same initial\r
81 > set of members, that they are aligned in a compatible way? I suppose it\r
82 > must work, but I'm still curious.\r
83 \r
84 If we have structures\r
85 \r
86 struct s1 { \r
87        long l1;\r
88        void * vp1;\r
89        short s1;\r
90        int i1;\r
91        char c1;\r
92 }\r
93 \r
94 &\r
95 \r
96 struct s2 { \r
97        long l1;\r
98        void * vp1;\r
99        short s1;\r
100        int i1;\r
101        char c1;\r
102        char c2;\r
103        // void * vp2;\r
104 };\r
105 \r
106 The variables l1, vp1, s1, i1 & c1 have same offset from the beginning of\r
107 structure and uses same amount of space in both structures...\r
108 \r
109 ... now the interesting point is what is the size of the structures (does C\r
110 compiler add padding to the end (to make the size multiple of something ?)\r
111 In any case all the other data is zeroed in the structure and sizeof data\r
112 is copied to "real" structure if Austin's suggestion is used...\r
113 \r
114 > Yet another approach would be to pass in array of descriptors, something\r
115 > like the command line argument parsing code does now.\r
116 >\r
117 > libnotmuch_opt_desc_t options[] = {\r
118 >   { LIBNOTMUCH_OPT_LOGHOOK, loghook },\r
119 >   { 0, 0} \r
120 > }\r
121 >\r
122 > I guess passing a (void *) as the second element of the pair?\r
123 \r
124 Voidp and only that. Then we can hack other variables using\r
125 ((char *)0 + (intvar)) or GINT_TO_POINTER... -- beautiful, eh ? ;)\r
126 \r
127 > Of course it's a bit more work to unpack this way.\r
128 \r
129 That is negligible to the elegance loss -- and what about bindings ! >;)\r
130 \r
131 \r
132 Tomi\r