summaryrefslogtreecommitdiff
path: root/b6/cba79eb46291f2499ce96e10f33603d6c3ba55
blob: 5ea60303a2b29687e9049874b98230763aa2948c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192]
	helo=mx.sourceforge.net)
	by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
	(envelope-from <s9jafroe@stud.uni-saarland.de>) id 1Ws8ec-0007w8-HY
	for bitcoin-development@lists.sourceforge.net;
	Wed, 04 Jun 2014 10:42:46 +0000
X-ACL-Warn: 
Received: from triton.rz.uni-saarland.de ([134.96.7.25])
	by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256)
	(Exim 4.76) id 1Ws8eZ-0006Zy-CK
	for bitcoin-development@lists.sourceforge.net;
	Wed, 04 Jun 2014 10:42:46 +0000
Received: from [10.9.24.121] (nat-eduroam4.uni-saarland.de [134.96.74.163])
	(authenticated bits=0)
	by triton.rz.uni-saarland.de (8.14.1/8.14.0) with ESMTP id
	s54AgZ5x030585
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO)
	for <bitcoin-development@lists.sourceforge.net>;
	Wed, 4 Jun 2014 12:42:36 +0200
X-Virus-Status: Clean
X-Virus-Scanned: clamav-milter 0.98.3 at HIZ-Mailrelay
	triton.rz.uni-saarland.de
Message-ID: <538EF81D.9060301@stud.uni-saarland.de>
Date: Wed, 04 Jun 2014 12:42:37 +0200
From: Jannis Froese <s9jafroe@stud.uni-saarland.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;
	rv:24.0) Gecko/20100101 Thunderbird/24.5.0
MIME-Version: 1.0
To: bitcoin-development@lists.sourceforge.net
References: <1401822421.27942.YahooMailNeo@web124505.mail.ne1.yahoo.com>	<CANEZrP18nf0oK6fbnE59opXxfMdwiOOu4v99iGyXyGo_7NLuYA@mail.gmail.com>
	<CAAS2fgTM30oFLGpkCwqM5Wf-Crmz5s05X-uWXAiGy9u43nbKvQ@mail.gmail.com>
In-Reply-To: <CAAS2fgTM30oFLGpkCwqM5Wf-Crmz5s05X-uWXAiGy9u43nbKvQ@mail.gmail.com>
X-Enigmail-Version: 1.6
Content-Type: multipart/alternative;
	boundary="------------040400060604090603040009"
X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by
	milter-greylist-3.0 (triton.rz.uni-saarland.de [134.96.7.25]);
	Wed, 04 Jun 2014 12:42:36 +0200 (CEST)
X-Spam-Score: 0.3 (/)
X-Spam-Report: Spam Filtering performed by mx.sourceforge.net.
	See http://spamassassin.org/tag/ for more details.
	-0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay
	domain 1.0 HTML_MESSAGE           BODY: HTML included in message
X-Headers-End: 1Ws8eZ-0006Zy-CK
Subject: Re: [Bitcoin-development] # error "Bitcoin cannot be compiled
 without assertions." <<<<NOT
X-BeenThere: bitcoin-development@lists.sourceforge.net
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=subscribe>
X-List-Received-Date: Wed, 04 Jun 2014 10:42:46 -0000

This is a multi-part message in MIME format.
--------------040400060604090603040009
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

There are reasons to have assertions enabled by default in software like
Bitcoin Core, where incorrect behaviour can be costly. But this comes at
a prize: our assertions have to satisfy certain performance
requirements. It's no longer possible to do expensive, redundant checks
in performance critical code, which is one of the main advantages of
asserts. Imho, asserts are not intended for small range checks etc, but
are meant for checks that a hash hasn't changed, that a tree structure
is still a tree, that data is still sorted, or that data structures are
in sync.

I think most concerns about the current use of asserts would be resolved
if the currently used asserts would be changed to a nicer definition
which is independent of NDEBUG, and a second class of debugging asserts
would be introduced, which is exclusively for expensive, redundant
checks and is disabled by NDEBUG.



Am 2014-06-04 12:15, schrieb Gregory Maxwell:
> On Wed, Jun 4, 2014 at 2:51 AM, Mike Hearn <mike@plan99.net
> <mailto:mike@plan99.net>> wrote:
>
>     Hi Ron,
>
>     FYI your mail is being spamfoldered due to Yahoo's DMARC policy
>     and the brokenness of the SF.net mailing list software. I would
>     not expect to get replies reliably whilst this is the case. I
>     think we should move away from SF.net for hosting mailing lists
>     personally, because it's this list that's at fault not Yahoo, but
>     until then you may wish to send to the list with a different email
>     address.
>
>     As to your question,
>
>         assert() should have *no* side effects, that is the problem.
>
>         See
>         http://books.google.com/books?id=L5ZbzVnpkXAC&pg=PA72&lpg=PA72&dq=Gotcha+%2328+Side+Effects&source=bl&ots=Rn15TlPmje&sig=tymHqta0aSANwaM2GaXC-1Di_tk&hl=en&sa=X&ei=uVKNU47fCcvTsAT6goHIBA&ved=0CCAQ6AEwAA#v=onepage&q=Gotcha%20%2328%20Side%20Effects&f=false
>
>         a great book, BTW.  Everyone who thinks they know what they
>         are doing when they write C++ should read this book!  They
>         will realize that they don't know Jack Roll Eyes
>
>         Why weren't these and all the other examples of amateur, i.e.,
>         non-professional, software fixed way back in version 0.3.0 in
>         2010, before any more releases were done?  And why were these
>         and other sub-standard coding practices continued and expanded
>         in later releases, right up until the present?
>
>
>     Back in 2010 most code was still being written by Satoshi so
>     perhaps you should ask him. Regardless, it's very common for
>     professional codebases to require assertions be enabled. For
>     example the entire Google C++ codebase uses always-on assertions
>     that have side effects liberally: it's convenient and safe, when
>     you have the guarantee the code will always run, and the
>     performance benefits of compiling out assertions are usually
>     non-existent.
>
>     So for this reason I think Bitcoin Core currently will fail to
>     build if assertions are disabled, and that seems OK to me.
>
>
> As a matter of procedure we do not use assertions with side effects---
> the codebase did at one point, but have cleaned them up.  In an
> abundance of caution we also made it refuse to compile without
> assertions enabled: A decision who's wisdom was clearly demonstrated
> when not long after, some additional side-effect having assert was
> contributed. In the real world errors happen here and there, and
> making robust software involves defense in depth.
>
> Considering the normal criticality of the software it should always be
> with the assertions. Without them is an untested configuration.  It
> would probably be superior to use our own assertion macros (for one,
> they can give some better reporting...) that don't have the baggage
> ordinary assertions have, but as a the codebase is a production thing,
> making larger changes all at once to satisfy aesthetics would be
> unwise... simply refusing to compile in that untested, unsupported
> configuration is prudent, for the time being.
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their 
> applications. Written by three acclaimed leaders in the field, 
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
>
>
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development


--------------040400060604090603040009
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">There are reasons to have assertions
      enabled by default in software like Bitcoin Core, where incorrect
      behaviour can be costly. But this comes at a prize: our assertions
      have to satisfy certain performance requirements. It's no longer
      possible to do expensive, redundant checks in performance critical
      code, which is one of the main advantages of asserts. Imho,
      asserts are not intended for small range checks etc, but are meant
      for checks that a hash hasn't changed, that a tree structure is
      still a tree, that data is still sorted, or that data structures
      are in sync.<br>
      <br>
      I think most concerns about the current use of asserts would be
      resolved if the currently used asserts would be changed to a nicer
      definition which is independent of NDEBUG, and a second class of
      debugging asserts would be introduced, which is exclusively for
      expensive, redundant checks and is disabled by NDEBUG.<br>
      <br>
      <br>
      <br>
      Am 2014-06-04 12:15, schrieb Gregory Maxwell:<br>
    </div>
    <blockquote
cite="mid:CAAS2fgTM30oFLGpkCwqM5Wf-Crmz5s05X-uWXAiGy9u43nbKvQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">On Wed, Jun 4, 2014 at 2:51 AM, Mike Hearn <span
          dir="ltr">&lt;<a moz-do-not-send="true"
            href="mailto:mike@plan99.net" target="_blank">mike@plan99.net</a>&gt;</span>
        wrote:<br>
        <div class="gmail_extra">
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div dir="ltr">Hi Ron,
                <div><br>
                </div>
                <div>FYI your mail is being spamfoldered due to Yahoo's
                  DMARC policy and the brokenness of the SF.net mailing
                  list software. I would not expect to get replies
                  reliably whilst this is the case. I think we should
                  move away from SF.net for hosting mailing lists
                  personally, because it's this list that's at fault not
                  Yahoo, but until then you may wish to send to the list
                  with a different email address.</div>
                <div><br>
                </div>
                <div>As to your question,</div>
                <div class="gmail_extra">
                  <div class="gmail_quote"><br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div>
                        <div
                          style="color:#000;background-color:#fff;font-family:Courier
New,courier,monaco,monospace,sans-serif;font-size:10pt">
                          <div>
                            <div>
                              <div
                                style="color:#000;background-color:#fff;font-family:Courier
New,courier,monaco,monospace,sans-serif;font-size:10pt">
                                <div
                                  style="color:rgb(0,0,0);font-size:13.3333px;font-family:Courier
New,courier,monaco,monospace,sans-serif;background-color:transparent;font-style:normal">
                                  <tt>assert() </tt>should have <span
                                    style="text-decoration:underline"><b>no</b></span>
                                  side effects, that is the problem.<br>
                                  <br>
                                  See<br>
                                  <a moz-do-not-send="true"
                                    rel="nofollow"
href="http://books.google.com/books?id=L5ZbzVnpkXAC&amp;pg=PA72&amp;lpg=PA72&amp;dq=Gotcha+%2328+Side+Effects&amp;source=bl&amp;ots=Rn15TlPmje&amp;sig=tymHqta0aSANwaM2GaXC-1Di_tk&amp;hl=en&amp;sa=X&amp;ei=uVKNU47fCcvTsAT6goHIBA&amp;ved=0CCAQ6AEwAA#v=onepage&amp;q=Gotcha%20%2328%20Side%20Effects&amp;f=false"
                                    target="_blank">http://books.google.com/books?id=L5ZbzVnpkXAC&amp;pg=PA72&amp;lpg=PA72&amp;dq=Gotcha+%2328+Side+Effects&amp;source=bl&amp;ots=Rn15TlPmje&amp;sig=tymHqta0aSANwaM2GaXC-1Di_tk&amp;hl=en&amp;sa=X&amp;ei=uVKNU47fCcvTsAT6goHIBA&amp;ved=0CCAQ6AEwAA#v=onepage&amp;q=Gotcha%20%2328%20Side%20Effects&amp;f=false</a><br>
                                  <br>
                                  a great book, BTW.&nbsp; Everyone who
                                  thinks they know what they are doing
                                  when they write C++ should read this
                                  book!&nbsp; They will realize that they
                                  don't know Jack <img
                                    moz-do-not-send="true" alt="Roll
                                    Eyes" border="0"></div>
                                <div
                                  style="color:rgb(0,0,0);font-size:13.3333px;font-family:Courier
New,courier,monaco,monospace,sans-serif;background-color:transparent;font-style:normal">
                                  <br>
                                </div>
                                <div
                                  style="color:rgb(0,0,0);font-size:13.3333px;font-family:Courier
New,courier,monaco,monospace,sans-serif;background-color:transparent;font-style:normal">Why
                                  weren't these and all the other
                                  examples of amateur, i.e.,
                                  non-professional, software fixed way
                                  back in version 0.3.0 in 2010, before
                                  any more releases were done?&nbsp; And why
                                  were these and other sub-standard
                                  coding practices continued and
                                  expanded in later releases, right up
                                  until the present? <br>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </blockquote>
                    <div><br>
                    </div>
                    <div>Back in 2010 most code was still being written
                      by Satoshi so perhaps you should ask him.
                      Regardless, it's very common for professional
                      codebases to require assertions be enabled. For
                      example the entire Google C++ codebase uses
                      always-on assertions that have side effects
                      liberally: it's convenient and safe, when you have
                      the guarantee the code will always run, and the
                      performance benefits of compiling out assertions
                      are usually non-existent.</div>
                    <div><br>
                    </div>
                    <div>So for this reason I think Bitcoin Core
                      currently will fail to build if assertions are
                      disabled, and that seems OK to me.</div>
                  </div>
                </div>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>As a matter of procedure we do not use assertions with
              side effects&#8212; the codebase did at one point, but have
              cleaned them up.&nbsp; In an abundance of caution we also made
              it refuse to compile without assertions enabled: A
              decision who's wisdom was clearly demonstrated when not
              long after, some additional side-effect having assert was
              contributed. In the real world errors happen here and
              there, and making robust software involves defense in
              depth.<br>
              <br>
            </div>
            <div>Considering the normal criticality of the software it
              should always be with the assertions. Without them is an
              untested configuration.&nbsp; It would probably be superior to
              use our own assertion macros (for one, they can give some
              better reporting&#8230;) that don't have the baggage ordinary
              assertions have, but as a the codebase is a production
              thing, making larger changes all at once to satisfy
              aesthetics would be unwise... simply refusing to compile
              in that untested, unsupported configuration is prudent,
              for the time being.<br>
              <br>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
<a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/NeoTech">http://p.sf.net/sfu/NeoTech</a></pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Bitcoin-development mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Bitcoin-development@lists.sourceforge.net">Bitcoin-development@lists.sourceforge.net</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/bitcoin-development">https://lists.sourceforge.net/lists/listinfo/bitcoin-development</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>

--------------040400060604090603040009--