summaryrefslogtreecommitdiff
path: root/c3/7b71790d1cb11d85486b14f222a430396c3b5a
blob: 843060fcab63961d4388980c9677867d29675945 (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
Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193]
	helo=mx.sourceforge.net)
	by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
	(envelope-from <rdwnj@yahoo.com>) id 1WsGfv-000659-SF
	for bitcoin-development@lists.sourceforge.net;
	Wed, 04 Jun 2014 19:16:39 +0000
Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of yahoo.com
	designates 98.138.229.33 as permitted sender)
	client-ip=98.138.229.33; envelope-from=rdwnj@yahoo.com;
	helo=nm40.bullet.mail.ne1.yahoo.com; 
Received: from nm40.bullet.mail.ne1.yahoo.com ([98.138.229.33])
	by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256)
	(Exim 4.76) id 1WsGfu-0000B5-1P
	for bitcoin-development@lists.sourceforge.net;
	Wed, 04 Jun 2014 19:16:39 +0000
Received: from [127.0.0.1] by nm40.bullet.mail.ne1.yahoo.com with NNFMP;
	04 Jun 2014 19:16:32 -0000
Received: from [98.138.100.118] by nm40.bullet.mail.ne1.yahoo.com with NNFMP;
	04 Jun 2014 19:13:45 -0000
Received: from [98.138.89.172] by tm109.bullet.mail.ne1.yahoo.com with NNFMP;
	04 Jun 2014 19:13:45 -0000
Received: from [127.0.0.1] by omp1028.mail.ne1.yahoo.com with NNFMP;
	04 Jun 2014 19:13:45 -0000
X-Yahoo-Newman-Property: ymail-4
X-Yahoo-Newman-Id: 334172.45172.bm@omp1028.mail.ne1.yahoo.com
Received: (qmail 5414 invoked by uid 60001); 4 Jun 2014 19:13:45 -0000
X-YMail-OSG: CRwVrV8VM1lfslh_cNmlME8v.pMZdQA_cYXBkdTnG2RECdG
	A1DwMPSHusWfUNZQafpKfMh3_l2PmFC5ny55scs7VymMhmaXwHp81JbDIlIE
	B6yvozQmBZ8wlk9m4TXdI9Id2T.h6.l.Pr98RhaSVnGsRMocmt2aYsLarGoY
	RxHmfPIzuYe9jsHbXdmrLP0ENDu_Kk1hRh5tfPWfE4LF9KpGvtC3XmiHVySO
	45DNyrTya0ZeSfLogE0ZTW81Z.phKX0VdZhtc3XuHIvpGYjSiYVQixswXX1N
	KRFLA4LBNHfZnBlmgE94vD_RTkfSIfNB1BP7KDCofdU5OaLdcHoUeeM0WJY2
	6VwT_UahTh1i4j7VgWGc1E3pxMGmt0N2PGkDiAmKWL6SM43oqh1SDcFgio2q
	Pj6p5OglHiCxGgSgllf4xKbUv5vnq4ceoBgGBA6O9cygPA2JH1NChPAqHzSb
	LfTzf8lbNhoq7Sweu02usb3cZBmZs9iB01uO2KSj1obLeXLlFzzdJqWYoUNc
	8e9StdEbLF965b5NXXZc4.cjgWi.vXr4NZoEMe8p2yqSFfKOIXDz78knpWao
	91slwiBOxgQhm9uz0kxX4sWbW3FKyM0jzSwHE8Pptdqhk3Nhck7XGUrPazNv
	.DhsYHsY81Ru25Zj1X3rpmkYLyNn22yXmf.QXcJNQ6SGTeAaKAeouQsZAZGq
	0PaYmljc-
Received: from [24.46.202.44] by web124505.mail.ne1.yahoo.com via HTTP;
	Wed, 04 Jun 2014 12:13:45 PDT
X-Rocket-MIMEInfo: 002.001,
	X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18NCiBNZXNzYWdlOiAyDQogRGF0ZTogV2VkLCA0IEp1biAyMDE0IDA4OjE1OjA4IC0wNDAwDQogRnJvbTogSmVmZiBHYXJ6aWsgPGpnYXJ6aWtAYml0cGF5LmNvbT4NCiBTdWJqZWN0OiBSZTogW0JpdGNvaW4tZGV2ZWxvcG1lbnRdICMgZXJyb3IgIkJpdGNvaW4gY2Fubm90DQogYmUgY29tcGlsZWQNCiDCoMKgwqAgd2l0aG91dCBhc3NlcnRpb25zLiIgPDw8PE5PVA0KIFRvOiBNaWtlIEhlYXJuIDxtaWtlQHBsYW4BMAEBAQE-
X-Mailer: YahooMailClassic/592 YahooMailWebService/0.8.188.663
Message-ID: <1401909225.83663.YahooMailBasic@web124505.mail.ne1.yahoo.com>
Date: Wed, 4 Jun 2014 12:13:45 -0700 (PDT)
From: Ron <rdwnj@yahoo.com>
To: bitcoin-development@lists.sourceforge.net
In-Reply-To: <mailman.192896.1401886427.2163.bitcoin-development@lists.sourceforge.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.6 (/)
X-Spam-Report: Spam Filtering performed by mx.sourceforge.net.
	See http://spamassassin.org/tag/ for more details.
	1.0 HK_RANDOM_FROM         From username looks random
	-1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for
	sender-domain
	0.6 HK_RANDOM_ENVFROM      Envelope sender username looks random
	0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
	(rdwnj[at]yahoo.com)
	-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,
	no trust [98.138.229.33 listed in list.dnswl.org]
	-0.0 SPF_PASS               SPF: sender matches SPF record
	-0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay
	domain
	-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
	author's domain
	0.1 DKIM_SIGNED            Message has a DKIM or DK signature,
	not necessarily valid
	-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
X-Headers-End: 1WsGfu-0000B5-1P
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 19:16:40 -0000

________________________________________________________
 Message: 2
 Date: Wed, 4 Jun 2014 08:15:08 -0400
 From: Jeff Garzik <jgarzik@bitpay.com>
 Subject: Re: [Bitcoin-development] # error "Bitcoin cannot
 be compiled
 =A0=A0=A0 without assertions." <<<<NOT
 To: Mike Hearn <mike@plan99.net>
 Cc: "bitcoin-development@lists.sourceforge.net"
 =A0=A0=A0 <bitcoin-development@lists.sourceforge.net>,
 Ron <rdwnj@yahoo.com>
 Message-ID:
 =A0=A0=A0
 <CAJHLa0PTTHfvd-1BR5s2k-4UW6V6qLEyAbF2YSRxOOSjtH9+_Q@mail.gmail.com>
 Content-Type: text/plain; charset=3DUTF-8
=20
 Yes, check macros like that can be useful.
=20
 I like the kernel's policy, which parallels our direction:
 1) Enable and use lightweight assertions for most users.
 2) No assertions with side effects
=20
 If you want to compile them out, that's fine, but they
 should always
 be present in production software.
 _____________________________________________________

I don't think many of you actually read what I said, and you went off on yo=
ur own tangents.

I said:
this commit and code with all side effects removed from the assertions.
in Vol 37, Issue 4

I intentionally left the gcc code alone.  Only the MSC code is assert "fixe=
d".  I would have hoped that someone would have noticed and incorporated th=
ese changes into the gcc code.  Simply by removing the #ifdef _MSC_VER ... =
#else ...  #endif etc. etc. =20

Did I say I compiled them out? No!  Did anyone bother to look at my code or=
 what I said?

Here is an example from main.cpp  CTransaction::UpdateCoins(...
-    // add outputs
+    // add outputs      sure looks like an assert with side effects here!?
+#ifdef _MSC_VER
+    bool
+        fTest =3D inputs.SetCoins(txhash, CCoins(*this, nHeight));
+    #ifdef _DEBUG
+        assert(fTest);
+    #else
+    if( !fTest )
+        releaseModeAssertionfailure( __FILE__, __LINE__, __PRETTY_FUNCTION=
__ );
+    #endif
+#else
     assert(inputs.SetCoins(txhash, CCoins(*this, nHeight)));
+#endif

Note that I do the test, and if debugging, I let it abort() the program if =
it fails.  Note that in release mode it calls a new function on failure, th=
at I leave you to discover what it does.  I see that this assert has been "=
fixed" in 0.9.x, but I think my "fix" is better, since it allows release mo=
de code to run better, if not identically.

I changed every assert() in the bitcoind 086 sources to behave this way.  S=
ince C++ is perniciously baroque, it is not clear if a side effect can or h=
as occurred in the most innocuous of C++ statements. Is the example above s=
ide-effect free?

Here is a piece of what I made my decision on:
http://www.gnu.org/software/libc/manual/html_node/Consistency-Checking.html=
 and the link to the book previously given.

Also, no one answered the question about bitcoin-qt, to whit, can or should=
 it be compiled in RELEASE mode because of this?  Should it have always bee=
n compiled in DEBUG mode in the past too?

Ron