#exult@irc.freenode.net logs for 2 Jan 2013 (GMT)

Archive Today Yesterday Tomorrow
Exult homepage


[00:12:16] <-- Malignant_Manor has left IRC (Quit: ChatZilla 0.9.89 [Firefox 17.0.1/20121128204232])
[00:39:17] <-- Dominus has left IRC (Read error: Connection reset by peer)
[00:39:23] --> DominusExult has joined #exult
[00:39:23] --- ChanServ gives channel operator status to DominusExult
[03:19:29] <-- DominusExult has left IRC (Read error: Connection reset by peer)
[03:19:34] --> Dominus has joined #exult
[03:19:35] --- ChanServ gives channel operator status to Dominus
[04:58:51] <-- i30817 has left #exult
[05:29:16] --> sh4rm4 has joined #exult
[07:43:20] <-- Dominus has left IRC (Read error: Connection reset by peer)
[07:44:56] --> Dominus has joined #exult
[07:44:57] --- ChanServ gives channel operator status to Dominus
[10:38:20] <-- Dominus has left IRC (Ping timeout: 255 seconds)
[10:39:03] --> Dominus has joined #exult
[10:39:03] --- ChanServ gives channel operator status to Dominus
[11:39:17] --> Marzo has joined #exult
[11:40:37] <Marzo> [04:32:13] <sh4rm4> <Marzo> wjp: I am thinking of 'porting' the files/tools still in plain C to C++
[11:40:37] <Marzo> [04:32:30] <sh4rm4> why ? so that it compiles "faster" ?
[11:41:06] <Marzo> So that Exult code base is more consistent? (i.e., all C++ instead of mixed C and C++)
[11:41:21] <sh4rm4> exult was originally C, correct ?
[11:41:47] <Marzo> Maybe, before there was a good C++ compiler
[11:42:07] <Marzo> At least since around 2000 it has been a C++ project
[11:42:36] <Marzo> (which is the earliest I am sure about of the top of my head)
[11:42:42] <sh4rm4> anyway, this consistency gives you no real advantage, only slower compilation speeds and work for changing something that already works well
[11:44:59] <Marzo> But the one thing that left me wondering and that prompted me to reply to this is: why do you think that linking to Linus displaying astonishing and willful ignorance would in any way help your case?
[11:45:52] <Marzo> And I just checked: first commit by Jeff 12 years ago was in C++ according to the logs
[11:46:39] <Marzo> There was a readme.dos back then :-)
[11:46:57] <sh4rm4> well my reasoning is described here https://github.com/rofl0r/debuglib/blob/master/LICENSE
[11:47:10] <sh4rm4> hehe
[11:47:10] <wjp> exult has always been C++ yes
[11:50:15] <Marzo> At the end, it is based off the same lack of understanding as Linus'
[11:50:49] <Marzo> I will give you that there are lots of bad C++ programmers
[11:51:39] <Marzo> But usin compilation speed as an argument? Really?
[11:51:55] <Marzo> s/usin/using
[11:51:56] <sh4rm4> i understand the difference between C and C++ quite well. C++ is basically all about comfort. you can make your editor autocomplete your code when you type object.
[11:52:26] <sh4rm4> but this comfort comes at a high price: vtable and oop bloat, name mangling etc
[11:52:55] <Marzo> So yes, you share the same basic misunderstanding as Linus
[11:53:00] <sh4rm4> when you use templates, things get even worse: tons of duplicated functions for each different type
[11:53:20] <Marzo> First point: anyone claiming that C++ is object oriented does not know anything about C++
[11:53:36] <Marzo> It has object oriented *features*, but you are not forced to use them
[11:53:43] <Marzo> (we have Java for that)
[11:53:51] <sh4rm4> and function overloading does not really give you any advantage, except that you now have 2 functions with the same name, that must be mangled differently
[11:54:31] <Marzo> Second: the vtable and oop overhead are probably actually less than it would be if you decided to implement the same stuff in C
[11:54:46] <Marzo> Because it has been optimized over the years
[11:54:47] <sh4rm4> it's much cleaner to have function_2args(a, b) and function_1arg(a) which calls function_2args with (a, defaultvalue_for_b)
[11:55:07] <Marzo> I disagree about that
[11:55:09] <sh4rm4> because the resulting symbol names and everything come out exactly as you named them
[11:55:39] <sh4rm4> with C, you always know what you end up with in your object file
[11:55:44] <Marzo> In math, for example, you use the same symbol to signify adding numbers, vectors, matrixes and tensors
[11:55:58] <Marzo> Because the underlying concept is the same
[11:55:59] <sh4rm4> C++ takes away that control, but gives you some comfort instead
[11:56:18] <sh4rm4> however that makes it a pain to keep libaries written in C++ binary compatible
[11:56:39] <sh4rm4> <Marzo> Second: the vtable and oop overhead are probably actually less than it would be if you decided to implement the same stuff in C
[11:56:45] <sh4rm4> well i wouldn't need to
[11:56:47] <Marzo> And templates: you almost always end up with better performance in generic code with templates than you do using C
[11:57:05] <Marzo> (09:55:59 AM) sh4rm4: C++ takes away that control, but gives you some comfort instead
[11:57:20] <sh4rm4> instead of a vtable, i'd just call class_func(obj x) instead of class.func()
[11:57:25] <Marzo> Are you even reading yourself? C++ does not enforce anything other than more strict typing
[11:57:42] <wjp> sh4rm4: saying that means you don't understand what a vtable is
[11:57:46] <sh4rm4> it enforces at least its name mangling scheme
[11:58:02] <wjp> but I think this is not the best place for such a discussion
[11:58:11] <Marzo> Lets cut the crap right from the start -- if you are claiming that C is better than C++, you are wrong right from the outset
[11:58:40] <sh4rm4> it's not even possible to write robust software in C++
[11:58:43] <Marzo> Since a valid C program is valid C++ program with a few minor tweaks, you would be claiming that C is better than itself
[11:58:49] <sh4rm4> what happens when you run out of memory ?
[11:59:03] <sh4rm4> you throw an OutOfMemory exception
[11:59:15] <Marzo> Which you can catch anywhere you want
[11:59:16] <sh4rm4> however that needs to allocate memory for that new object, so...
[12:01:14] <Marzo> In C, you can also run out of memory -- and you have to explicitly check if you got the memory you need at every point in your program
[12:01:35] <Marzo> So it leads to lots of duplicate code that you have to write, instead of being generated by the compiler
[12:01:35] <sh4rm4> yes, but it makes it possible to handle it
[12:01:58] <Marzo> You can treat it in C++ too -- just catch the damn exception
[12:02:19] <sh4rm4> well the problem is that you can't allocate the exception object
[12:02:40] <Marzo> So?
[12:02:44] <sh4rm4> it'll just crash doing new OutOfMemoryException()
[12:02:58] <Marzo> Why would you even do that?
[12:03:23] <sh4rm4> to raise the exception
[12:03:25] <Marzo> When you do "new Object" and it fails with out of memory, the exception is automatically generated
[12:03:33] <Marzo> You don't need to raise it
[12:03:47] <Marzo> And if you want to raise it, you use throw OutOfMemoryException()
[12:04:16] <sh4rm4> so how do you handle that exception, that may be 10 levels of nested function calls away ?
[12:04:37] <Marzo> You handle it where you want to handle it
[12:04:39] <sh4rm4> doesnt throw OutOfMemoryException() try to create a new object ?
[12:05:02] <Marzo> It is a very light object
[12:05:11] <sh4rm4> if you want to handle it sanely, you have to catch it at the very spot you would check the pointer in C
[12:05:44] <Marzo> The C++ compiler calls destructors for all objects on all levels skipped
[12:05:46] <sh4rm4> the only thing you can do from 10 nested levels away is printing "oops" << endl
[12:05:53] <Marzo> And sets the stack to the appropriate level it should be
[12:06:20] <Marzo> You can set the program back to a sane state instead of returning an error code for the same 10 levels
[12:06:39] <Marzo> (which would be how C handles it)
[12:09:20] <sh4rm4> anyway: when we look at the C++ switch from GCC, what are the consequences? 1) it will take even more time to compile 2) you can't bootstrap GCC anymore without an already available C++ compiler and std lib that supports all of the features they need
[12:11:20] <sh4rm4> and it'll definitely use more ram (GCC 4.5 needs about 1.2 GB ram to bootstrap itself)
[12:11:22] <Marzo> You are saying it as if you could bootstrap GCC without an available C compiler
[12:11:34] <sh4rm4> now with all the vtables, that will become 2 GB easily
[12:11:55] <sh4rm4> yes, but i could for example bootstrap it with PCC or TCC
[12:12:19] <sh4rm4> and that would give me a C *and* a C++ compiler
[12:19:07] <sh4rm4> http://www.dwheeler.com/trusting-trust/ <- this would not have been possible with a GCC written in C++. he used TCC as the bootstrap compiler
[12:23:12] <Marzo> Yeah, and he assumes that the two compilers will output bit-for-bit identical binaries
[12:23:29] <Marzo> Add one optimization that one compiler does which the other doesn't and it fails
[12:24:15] <Marzo> So you could not bootstrap GCC with ICC, for example, because ICC does all those wonderful Intel-only optimizations
[12:24:30] <Marzo> (for his purposes, anyway)
[12:24:34] <sh4rm4> wrong, he uses compiler B to compile compiler A (=C), and compiler A to compile compiler A (=D) and then compares C and D
[12:25:01] <Marzo> That is what I said?
[12:25:01] <sh4rm4> *compares binaries generated by C and D
[12:25:13] <Marzo> (10:23:12 AM) Marzo: Yeah, and he assumes that the two compilers will output bit-for-bit identical binaries
[12:25:20] <Marzo> See?
[12:26:08] <sh4rm4> yes, and that is a valid assumption, that 2 GCC4.5.1 (each of them compiled with a different compiler) will produce identical code
[12:26:54] <Marzo> So basically you are saying your point is wrong anyway
[12:27:03] <sh4rm4> why ?
[12:27:08] <Marzo> You already have a version of a compiler you trust
[12:27:33] <Marzo> If the compiler was written in VB it would not change that
[12:27:42] <sh4rm4> i can only trust TCC because the code is small enough to be understandable by a single human
[12:27:53] <sh4rm4> i can never trust the entire gcc
[12:28:16] <Marzo> So you don't trust your OS, I gather?
[12:28:37] <Marzo> Unless you use a plain command-line interface, that is
[12:29:00] <Marzo> (and even then, with very few programs running)
[12:29:11] <sh4rm4> i don't trust it really, no.
[12:29:21] <Marzo> Yeah, I thought so
[12:29:44] <Marzo> In any case, this is what code audits are for
[12:29:59] <Marzo> You get a team of people that work to understand the code
[12:30:07] <Marzo> It helps if the code is modularized
[12:30:23] <sh4rm4> which is possible with C as well
[12:31:14] <Marzo> It is possible with VB as well, so it is not a big deal
[12:53:28] --> TheCycoONE has joined #exult
[13:06:04] <-- Kirben has left IRC ()
[13:13:42] <Marzo> Dominus: you there?
[13:19:43] <-- Dominus has left IRC (Read error: Connection reset by peer)
[13:19:57] --> Dominus has joined #exult
[13:19:57] --- ChanServ gives channel operator status to Dominus
[13:57:49] <Dominus> Marzo: not reliably :)
[13:58:06] <Dominus> probably later tonight (GMT)
[13:58:26] <Dominus> but I' can read and answer with some gaps in between :)
[14:40:16] --> i30817 has joined #exult
[14:59:07] <Dominus> i30817: http://vogons.zetafleet.com/viewtopic.php?p=289440#289440
[15:00:20] <i30817> I saw it. Synchronicity, i'm was just now on #munt asking about it.
[15:32:38] <-- i30817 has left IRC (Quit: ChatZilla 0.9.89 [Firefox 17.0.1/20121129151842])
[15:34:58] <Dominus> he he, there is #munt? (of course there is, I just never checked :))
[18:27:23] <Dominus> marzo, now I have more time :)
[18:39:44] <-- Dominus has left IRC (Read error: Connection reset by peer)
[18:41:06] --> Dominus has joined #exult
[18:41:06] --- ChanServ gives channel operator status to Dominus
[19:35:21] --> i30817 has joined #exult
[19:42:24] --> Marzo1 has joined #exult
[19:42:25] <-- Marzo has left IRC (Disconnected by services)
[20:51:38] <-- Dominus has left IRC (Read error: Connection reset by peer)
[20:52:08] --> Dominus has joined #exult
[20:52:09] --- ChanServ gives channel operator status to Dominus
[21:25:12] --> DominusExult has joined #exult
[21:25:12] --- ChanServ gives channel operator status to DominusExult
[21:25:42] <-- Dominus has left IRC (Read error: Connection reset by peer)
[21:25:43] --- DominusExult is now known as Dominus
[22:00:02] <Dominus> I'll be gone till saturday or so. got to fly home tomorrow, funeral...
[22:17:39] <-- Dominus has left IRC (Quit: good night)
[22:22:44] <-- i30817 has left IRC (Ping timeout: 248 seconds)
[22:24:32] <-- TheCycoONE has left IRC (Quit: And then there were n-1)
[22:42:01] --> Kirben has joined #exult
[22:42:02] --- ChanServ gives channel operator status to Kirben