--- Day changed Tue Sep 01 2020 01:54 -!- jonatack [~jon@2a01:e0a:53c:a200:bb54:3be5:c3d0:9ce5] has quit [Ping timeout: 240 seconds] 02:08 -!- Jackielove4u [uid43977@gateway/web/irccloud.com/x-uzbqdtfectxnzali] has quit [Ping timeout: 240 seconds] 02:09 -!- Jackielove4u [uid43977@gateway/web/irccloud.com/x-owobwaotmctfvyxe] has joined #bitcoin-core-pr-reviews 02:37 -!- jonatack [~jon@213.152.162.10] has joined #bitcoin-core-pr-reviews 03:20 -!- Joy44Schuppe [~Joy44Schu@static.57.1.216.95.clients.your-server.de] has joined #bitcoin-core-pr-reviews 03:25 -!- Joy44Schuppe [~Joy44Schu@static.57.1.216.95.clients.your-server.de] has quit [Ping timeout: 258 seconds] 03:59 -!- vasild [~vd@gateway/tor-sasl/vasild] has quit [Ping timeout: 240 seconds] 03:59 -!- vasild [~vd@gateway/tor-sasl/vasild] has joined #bitcoin-core-pr-reviews 04:27 -!- jonatack [~jon@213.152.162.10] has quit [Ping timeout: 260 seconds] 05:07 -!- peltre [sid268329@gateway/web/irccloud.com/x-jlchgmwcrmvkukbj] has quit [Quit: Connection closed for inactivity] 05:59 -!- jonatack [~jon@2a01:e0a:53c:a200:bb54:3be5:c3d0:9ce5] has joined #bitcoin-core-pr-reviews 06:25 < jnewbery> This week's post incorrectly stated the date of the meeting as Sept 5th. It should have said tomorrow, Sept 2nd. Sorry for the confusion! 06:29 -!- sharknado9000[m] [sharknado9@gateway/shell/matrix.org/x-oomoagcywcynnbmc] has joined #bitcoin-core-pr-reviews 06:41 -!- kimgnome [~manjaro-g@2804:14d:baa1:8ad0:7e67:a2ff:fee6:efb] has joined #bitcoin-core-pr-reviews 06:46 -!- kimgnome [~manjaro-g@2804:14d:baa1:8ad0:7e67:a2ff:fee6:efb] has quit [Quit: Leaving] 07:25 -!- davterra [~davterra@gateway/tor-sasl/tralfaz] has quit [Remote host closed the connection] 07:26 -!- davterra [~davterra@gateway/tor-sasl/tralfaz] has joined #bitcoin-core-pr-reviews 07:40 -!- TheRec_ [~toto@84-75-225-47.dclient.hispeed.ch] has joined #bitcoin-core-pr-reviews 07:40 -!- TheRec_ [~toto@84-75-225-47.dclient.hispeed.ch] has quit [Changing host] 07:40 -!- TheRec_ [~toto@drupal.org/user/146860/view] has joined #bitcoin-core-pr-reviews 07:48 -!- TheRec [~toto@drupal.org/user/146860/view] has quit [Read error: Connection reset by peer] 08:29 < pinheadmz> all this back and forth... what is this, BIP340? 08:29 * pinheadmz ducks 09:18 * wumpus sheds a bike 09:29 -!- Talkless [~Talkless@hst-227-49.splius.lt] has joined #bitcoin-core-pr-reviews 09:50 -!- peltre [uid268329@gateway/web/irccloud.com/x-zsqovrilvgrdckyd] has joined #bitcoin-core-pr-reviews 09:51 -!- peltre [uid268329@gateway/web/irccloud.com/x-zsqovrilvgrdckyd] has quit [Client Quit] 10:07 < michaelfolkson> #finalfinaldate 10:45 -!- Netsplit *.net <-> *.split quits: aqua42, likewhoa, CubicEarth 10:46 -!- Netsplit over, joins: CubicEarth, likewhoa, aqua42 11:22 -!- Talkless [~Talkless@hst-227-49.splius.lt] has quit [Quit: Konversation terminated!] 12:55 -!- kristapsk_ is now known as kristapsk 13:14 -!- dhruv [881873f9@gateway/web/cgi-irc/kiwiirc.com/ip.136.24.115.249] has joined #bitcoin-core-pr-reviews 13:53 -!- dhruv [881873f9@gateway/web/cgi-irc/kiwiirc.com/ip.136.24.115.249] has quit [Ping timeout: 240 seconds] 13:59 -!- dhruv [881873f9@gateway/web/cgi-irc/kiwiirc.com/ip.136.24.115.249] has joined #bitcoin-core-pr-reviews 14:52 -!- robot-dreams [~robot-dre@172.92.4.53] has joined #bitcoin-core-pr-reviews 14:54 -!- robot-dreams [~robot-dre@172.92.4.53] has quit [Client Quit] 14:57 -!- robot-dreams [~robot-dre@172.92.4.53] has joined #bitcoin-core-pr-reviews 14:58 -!- gzhao408 [uid453516@gateway/web/irccloud.com/x-ysgsmkxckcazkctb] has joined #bitcoin-core-pr-reviews 15:30 -!- musdom [cab8171a@202.184.23.26] has joined #bitcoin-core-pr-reviews 15:36 -!- musdom [cab8171a@202.184.23.26] has quit [Remote host closed the connection] 15:36 -!- musdom [cab8171a@202.184.23.26] has joined #bitcoin-core-pr-reviews 15:42 -!- musdom [cab8171a@202.184.23.26] has quit [Remote host closed the connection] 15:44 -!- musdom [~Thunderbi@202.184.23.26] has joined #bitcoin-core-pr-reviews 15:47 < pinheadmz> If i have a struct A with members {A, B} and struct B with members {A, B, C} such that struct B is a subclass of struct A. And I start a function with a struct B but cast it to a struct A -- does member C just get gracefully ignored? What about the other direction? is member C uninitialized in that case? 15:48 -!- shesek [~shesek@unaffiliated/shesek] has joined #bitcoin-core-pr-reviews 15:55 -!- musdom [~Thunderbi@202.184.23.26] has quit [Quit: musdom] 15:57 -!- musdom [~Thunderbi@202.184.23.26] has joined #bitcoin-core-pr-reviews 15:58 -!- vasild [~vd@gateway/tor-sasl/vasild] has quit [Ping timeout: 240 seconds] 15:59 < gwillen> pinheadmz: as far as I know casting between unrelated structs or struct pointers is always illegal 15:59 < gwillen> 'subclass' as a concept does not exist in C 16:00 < gwillen> I think the only exception is casting between a pointer to a struct, and a pointer to its first element, which I believe is legal 16:01 -!- vasild [~vd@gateway/tor-sasl/vasild] has joined #bitcoin-core-pr-reviews 16:01 < gwillen> (so if you switched things up so that struct B started with a struct A as its first element, rather than just the same list of members as struct A, you could cast between _pointers_ to them, as long as the underlying object you started with was a struct B) 16:06 < robot-dreams> Great questions. I agree with gwillen that 'subclass' doesn't exist in the C programming language 16:07 < robot-dreams> Doing some experiments in C++: 16:07 < robot-dreams> struct A { 16:07 < robot-dreams> int x; 16:07 < robot-dreams> int y; 16:07 < robot-dreams> }; 16:07 < robot-dreams> struct B : A { 16:07 < gwillen> pinheadmz: actually I don't know why I assumed C rather than C++, I think I just saw the word struct, if you're talking about actual subclasses then the answer is something else (you can cast a subclass to the base class and it just throws members away, which is bad and you shouldn't; you can't cast base class to subclass.) 16:07 < robot-dreams> int z; 16:07 < robot-dreams> }; 16:07 < gwillen> (the thing you actually always want to do is cast _pointers_, in which case everything behaves reasonably) 16:08 < robot-dreams> It seems like the following is allowed: 16:08 < robot-dreams> void foo(A a) { cout << a.x << endl; } // prints 1 16:08 < robot-dreams> int main() { 16:08 < robot-dreams> B b = {1, 2, 3}; 16:09 < robot-dreams> foo(b); // casts a B into an A 16:09 < robot-dreams> } 16:09 < gwillen> that behavior is called 'object slicing': https://en.wikipedia.org/wiki/Object_slicing 16:09 < robot-dreams> But casting in the other direction results in a compile error: 16:10 < gwillen> it is usually considered undesirable, but if your objects are pure structs with no methods it's no different from first casting a pointer, then making a copy (as far as I know) 16:14 < robot-dreams> Thanks gwillen for the explanation, that makes sense to me and seems to encompass the tests I tried 16:14 -!- musdom [~Thunderbi@202.184.23.26] has quit [Quit: musdom] 16:15 < gwillen> for sure, I find that usually people only do this by accident, and you can almost always get what you want by casting pointers instead 16:15 -!- musdom [~Thunderbi@202.184.23.26] has joined #bitcoin-core-pr-reviews 16:30 < pinheadmz> here's where i got "subclass" even though yeah I know thats more a C++ concept: https://github.com/libuv/libuv/blob/v1.x/include/uv.h#L488 16:31 < pinheadmz> sorry i should have explciitly said C not C++ 16:31 < pinheadmz> thanks gwillen robot-dreams this is helpful 16:32 < gwillen> ok cool yeah, very welcome, I don't know how (or whether) libuv handles casting those without causing undefined behavior 16:33 < gwillen> (I expect you can do it safely using memcpy, anything cleverer than that contains dragons) 16:34 < gwillen> everything will be much better if you use the "base class is first member of subclass" pattern instead, which makes it legal to cast between pointers to them 16:34 < gwillen> with the only cost being the need for more dots when accessing things that are nested 16:34 -!- dhruv [881873f9@gateway/web/cgi-irc/kiwiirc.com/ip.136.24.115.249] has quit [Ping timeout: 240 seconds] 16:48 -!- kristapsk [~KK@gateway/tor-sasl/kristapsk] has quit [Remote host closed the connection] 16:50 -!- dhruv [881873f9@gateway/web/cgi-irc/kiwiirc.com/ip.136.24.115.249] has joined #bitcoin-core-pr-reviews 16:56 < pinheadmz> https://gist.github.com/pinheadmz/25cfc0b624e9a6dec3df0c12b56053ae 16:57 < pinheadmz> as expected I guess, members get sliced off and return unitialized garbage 16:57 < pinheadmz> going the other direction of course the member doesn exist, but the actual casting pointers didnt throw 16:58 < gwillen> a c-style cast will never throw, they are not defined to do so 16:58 -!- dhruv [881873f9@gateway/web/cgi-irc/kiwiirc.com/ip.136.24.115.249] has quit [Quit: Connection closed] 16:58 < pinheadmz> ah ok 16:58 < gwillen> but many possibly uses of c-style cases are undefined behavior and must not be used 16:58 < gwillen> possible* 16:58 < pinheadmz> makes sense, its just a pointer 16:59 < gwillen> as far as I'm aware casting between unrelated types or pointers to unrelated types, such as your structs here, is always undefined behavior 16:59 < pinheadmz> I think I like C better than C++ :-) 16:59 < robot-dreams> Line 24 specifically is not only uninitialized garbage, it's undefined behavior, right? 16:59 -!- dhruv [881873f9@gateway/web/cgi-irc/kiwiirc.com/ip.136.24.115.249] has joined #bitcoin-core-pr-reviews 16:59 < gwillen> line 20 is already undefined behavior 16:59 < gwillen> which means that the compiler is free to throw the whole program away or do whatever it wants (gcc is not known for being aggressive about this, but clang is) 17:00 < pinheadmz> oh interesting, so clang would throw on line 20? 17:00 < gwillen> no, there are no exceptions involved 17:00 < pinheadmz> ok 17:00 -!- dhruv [881873f9@gateway/web/cgi-irc/kiwiirc.com/ip.136.24.115.249] has left #bitcoin-core-pr-reviews [] 17:00 < gwillen> undefined behavior means "your program violates the C standard, and as such the compiler makes no promises about what happens when you compile it" 17:01 < gwillen> for example, if clang can see that a function performs undefined behavior, it is free to simply consider the entire function dead code and compile it out 17:01 < gwillen> the results may be obviously broken or they may just be weird, it is entirely up to clang 17:01 -!- dhruvm [881873f9@gateway/web/cgi-irc/kiwiirc.com/ip.136.24.115.249] has joined #bitcoin-core-pr-reviews 17:02 < gwillen> (gcc is also free to do this, but I am picking on clang because it often actually _does_ things like this in practice, whereas people are used to gcc mostly not doing so) 17:20 -!- kristapsk [~KK@gateway/tor-sasl/kristapsk] has joined #bitcoin-core-pr-reviews 17:43 -!- dhruvm [881873f9@gateway/web/cgi-irc/kiwiirc.com/ip.136.24.115.249] has quit [Ping timeout: 260 seconds] 17:51 -!- Jackielove4u [uid43977@gateway/web/irccloud.com/x-owobwaotmctfvyxe] has quit [Quit: Connection closed for inactivity] 18:12 -!- seven_ [~seven@2a00:ee2:410c:1300:c463:7b9b:59e3:bb1] has quit [Read error: Connection reset by peer] 18:47 -!- dhruvm [881873f9@gateway/web/cgi-irc/kiwiirc.com/ip.136.24.115.249] has joined #bitcoin-core-pr-reviews 18:48 -!- jb55 [~jb55@gateway/tor-sasl/jb55] has quit [Ping timeout: 240 seconds] 18:56 -!- dhruvm [881873f9@gateway/web/cgi-irc/kiwiirc.com/ip.136.24.115.249] has quit [Ping timeout: 240 seconds] 19:04 -!- jb55 [~jb55@gateway/tor-sasl/jb55] has joined #bitcoin-core-pr-reviews 19:21 -!- shesek [~shesek@unaffiliated/shesek] has quit [Remote host closed the connection] 21:16 -!- musdom [~Thunderbi@202.184.23.26] has quit [Ping timeout: 256 seconds] 23:00 -!- fjahr [sid374480@gateway/web/irccloud.com/x-bmmgceumnrjoxebt] has quit [Ping timeout: 240 seconds] 23:01 -!- hebasto [sid449604@gateway/web/irccloud.com/x-sbluzgthtqieiduz] has quit [Ping timeout: 260 seconds] 23:02 -!- ethzero_ [sid396973@gateway/web/irccloud.com/x-yuxridwroepmcwgb] has quit [Ping timeout: 260 seconds] 23:02 -!- digi_james [sid281632@gateway/web/irccloud.com/x-sdmniruwkbrwrymz] has quit [Ping timeout: 240 seconds] 23:03 -!- fjahr [sid374480@gateway/web/irccloud.com/x-vddusacsufeecjsf] has joined #bitcoin-core-pr-reviews 23:03 -!- digi_james [sid281632@gateway/web/irccloud.com/x-sylyhzpfflhldnib] has joined #bitcoin-core-pr-reviews 23:03 -!- ethzero_ [sid396973@gateway/web/irccloud.com/x-fzqizwhtdulboakp] has joined #bitcoin-core-pr-reviews 23:04 -!- hebasto [sid449604@gateway/web/irccloud.com/x-enlpbaqgczxghrrp] has joined #bitcoin-core-pr-reviews 23:20 -!- dhruvm [881873f9@gateway/web/cgi-irc/kiwiirc.com/ip.136.24.115.249] has joined #bitcoin-core-pr-reviews 23:27 -!- seven_ [~seven@2a00:ee2:410c:1300:a09b:2a1a:72d7:b7cb] has joined #bitcoin-core-pr-reviews 23:28 -!- dhruvm [881873f9@gateway/web/cgi-irc/kiwiirc.com/ip.136.24.115.249] has quit [Ping timeout: 265 seconds] 23:48 -!- Jackielove4u [uid43977@gateway/web/irccloud.com/x-gqphafrvekahiyii] has joined #bitcoin-core-pr-reviews 23:56 -!- evanlinjin [~evanlinji@2404:4408:43ff:bb00:a371:3249:2d3a:5a16] has quit [Quit: Konversation terminated!] 23:57 -!- evanlinjin [~evanlinji@2404:4408:43ff:bb00:54d6:162b:a8d7:7fa4] has joined #bitcoin-core-pr-reviews 23:58 -!- seven_ [~seven@2a00:ee2:410c:1300:a09b:2a1a:72d7:b7cb] has quit [Remote host closed the connection] 23:58 -!- seven_ [~seven@2a00:ee2:410c:1300:a09b:2a1a:72d7:b7cb] has joined #bitcoin-core-pr-reviews