code logs -> 2007 -> Sun, 28 Jan 2007< code.20070127.log - code.20070129.log >
--- Log opened Sun Jan 28 00:00:47 2007
00:33 AnnoDomini [~farkoff@Nightstar-28891.neoplus.adsl.tpnet.pl] has quit [Quit: If nothing we do matters, all that matters is that we do.]
00:53 Reiver [~reaverta@IRCop.Nightstar.Net] has joined #Code
00:53 mode/#code [+o Reiver] by ChanServ
00:56 Reiver [~reaverta@IRCop.Nightstar.Net] has quit [Ping Timeout]
01:00 Reiver [~reaverta@IRCop.Nightstar.Net] has joined #Code
01:00 mode/#code [+o Reiver] by ChanServ
01:33 Derakon [~Derakon@Nightstar-12737.sea2.cablespeed.com] has joined #code
01:34
< Derakon>
Anyone know how I could go about adding a virtual operator<< to a class in C++?
01:34
< Derakon>
My understanding of such operators is that they have to be declared outside of the class, though my memory of why is a bit hazy.
01:37
< MyCatVerbs>
Derakon: class foo { friend function iostream& operator<< (iostream&, foo&); } <--- it's because the function in question isn't a member of the class, doesn't return an object of that class, etc.
01:38
< Derakon>
I have a working operator<< function; I just need to make it virtual.
01:39
< Derakon>
Which, among other things, would mean that I can't actually name the class in the arguments...hrm.
01:39
< Derakon>
Basically, I want to do "cout << someComponent << endl;", and either call the Module operator<< or the Hardpoint operator<<, as appropriate.
01:40 Reiver [~reaverta@IRCop.Nightstar.Net] has quit [Ping Timeout]
01:41
< MyCatVerbs>
Derakon: you can't make it virtual, you'll instead want to have the functions that it calls be virtual.
01:41
< Derakon>
Ergh...I guess that means implementing toString, then. :\
01:42
< MyCatVerbs>
Yup. operator<< would then just be a stub saying {output << this->tostring();}, where tostring() is of course virtual.
01:43
< MyCatVerbs>
Incidentally, welcome to OOP! Isn't it such a wonderful improvement over all that messy pure-proceedural stuff? Despite having ten times as much fucking code, of course. >_>
01:43
< Derakon>
I find it much easier to think OO-style than procedurally, though, so I'd say it's a net gain.
01:43
< Derakon>
I thought about how I would go about writing this program procedurally, and it hurts my brain.
01:47
< MyCatVerbs>
You'd fake OOP, which is pretty trivial if you think it over carefully. :P
01:47
< Derakon>
Oh, yeah.
01:47
< Derakon>
Class -> struct. Just pass the struct in as the first argument to every class function. Just like OOP, except with messier syntax and without any data hiding. Or inheritance.
01:48
< MyCatVerbs>
Except that it'd probably come to about the same amount of code anyway, what with the need to reimplement features using pure C balenced against the total brain damage of C++.
01:52
< Derakon>
Oh, wow, that was silly.
01:52
< Derakon>
I was hunting down this compile error for about fifteen minutes. Turns out I spelled "private" "priivate".
01:54
<@Vornicus-Latens>
Poor Der.
01:55
<@Vornicus-Latens>
Also, to create an operator inside a class, it's just operator<< (type& other);
01:55
< Derakon>
I'm aware of that, but output operators are kinda funky.
01:55
< Derakon>
Because the thing you're outputting is the second argument (the first is the stream).
01:55
<@Vornicus-Latens>
To add an operator to an existing class, it's operator<< (type& original, type& other);
01:56 Reiver [~reaverta@IRCop.Nightstar.Net] has joined #Code
01:56 mode/#code [+o Reiver] by ChanServ
01:58
< MyCatVerbs>
Derakon: to add an operator to an existing class, it's www.bruceeckel.com, grab the PDFs of "Thinking in C++" and see how he does it in his example code. =D
01:58
< Derakon>
That's what I'm doing with the normal output operator.
01:59
< Derakon>
But since I'm adding it to the ostream class instead of to my own, it can't be virtual.
01:59
< MyCatVerbs>
Hrmn, no Brucket Eckel.com? Oh well, http://www.janiry.com/bruce-eckel/
01:59
< MyCatVerbs>
Derakon: it's supposed to be global, not a member of ostream. ?_?
02:00
< Derakon>
ostream& operator<<(ostream stream, const Component& src);
02:03
< Derakon>
...why can't I concatenate together more than two strings in a row?
02:03
< Derakon>
"string result = "Hardpoint " + id;" works.
02:03
< Derakon>
"string result = "Hardpoint " + id + " with name " + name" does not.
02:03
< Derakon>
error: invalid operands of types 'const char*' and 'const char [8]' to binary 'operator+'
02:04
< Derakon>
They're strings! Get it through your thick skull!
02:04
< Derakon>
I really, really don't want to do "string result = string("Hardpoint " + id) + string(" with name " + name);
02:04
< Derakon>
"
02:05 gnolam [Lenin@Nightstar-13557.8.5.253.se.wasadata.net] has quit [Quit: Sleep]
02:05
< MyCatVerbs>
Derakon: it's C++.
02:06
< MyCatVerbs>
Derakon: what were you expecting, sense?
02:06
< Derakon>
Most of C++ isn't terrible. The real crap is stuff it inherited from C. Like strings that want to be character arrays.
02:09 Vornicus-Latens is now known as Vornicus
02:09 MyCatVerbs is now known as MyCatSleeps
02:12 Derakon is now known as Derakon[Dinner]
02:44 Reiver [~reaverta@IRCop.Nightstar.Net] has quit [Ping Timeout]
02:45 Reiver [~reaverta@IRCop.Nightstar.Net] has joined #Code
02:45 mode/#code [+o Reiver] by ChanServ
02:54 Reiver [~reaverta@IRCop.Nightstar.Net] has quit [Quit: I ATENT'T DEAD]
02:54 Reiver [~reaverta@IRCop.Nightstar.Net] has joined #Code
02:54 mode/#code [+o Reiver] by ChanServ
02:59 Reiver [~reaverta@IRCop.Nightstar.Net] has quit [Ping Timeout]
03:04 Reiver [~reaverta@IRCop.Nightstar.Net] has joined #Code
03:04 mode/#code [+o Reiver] by ChanServ
03:36 Derakon[Dinner] is now known as Derakon
04:44
< Derakon>
Hrm...so given that Hardpoint and Module both inherit from Component, and Component has some virtual functions, if I'm in a Component context, I can't call a virtual function and have it resolve to the Module/Hardpoint implementation, can I?
05:04
<@Vornicus>
If the thing the method is being called on is a hardpoint, it will act like a hardpoint as to virtual methods.
05:05
< Derakon>
Even if it's in a Component function?
05:08
<@Vornicus>
I believe so.
05:09
< Derakon>
That doesn't jibe with the failures I'm getting here...
05:10
< Derakon>
addChild is a virtual function declared in Component that is implemented in both Hardpoint and Module.
05:11
< Derakon>
I'm in Component::attach as a Hardpoint, and I call addChild. I get "pure virtual method called" and "terminate called without an active exception" and my program dies.
05:14
< Derakon>
Don't think there was, actually.
05:14
< Derakon>
Er, wrong channel.
05:53 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
05:53 mode/#code [+o Chalcedon] by ChanServ
06:04 Chalcy [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
06:04 mode/#code [+o Chalcy] by ChanServ
06:05 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout]
06:08 Chalcy [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout]
06:09 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
06:09 mode/#code [+o Chalcedon] by ChanServ
06:21 Reiver is now known as ReivOut
07:17 Chalcedon is now known as ChalcyGrumpy
07:23 ReivOut is now known as Reiver
07:58 Derakon is now known as Derakon[AFK]
08:13 timelady [~romana@Nightstar-14746.lns6.adl2.internode.on.net] has joined #Code
08:26 Derakon[AFK] [~Derakon@Nightstar-12737.sea2.cablespeed.com] has quit [Connection reset by peer]
08:33 Chalcy [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
08:33 mode/#code [+o Chalcy] by ChanServ
08:35 ChalcyGrumpy [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout]
08:39 Chalcy is now known as Chalcedon
08:45 Vornicus is now known as Vornicus-Latens
08:45 timelady [~romana@Nightstar-14746.lns6.adl2.internode.on.net] has quit [Quit: kids]
09:17 Chalcy [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
09:18 mode/#code [+o Chalcy] by ChanServ
09:18 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout]
09:18 Chalcy is now known as Chalcedon
09:19 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Quit: ]
09:37 Mahal is now known as MahalBEDD
09:37 You're now known as TheWatcher
10:50 AnnoDomini [~farkoff@Nightstar-28891.neoplus.adsl.tpnet.pl] has joined #Code
11:16 GeekSoldier [IceChat7@Nightstar-3222.pools.arcor-ip.net] has joined #code
11:34 GeekSoldier [IceChat7@Nightstar-3222.pools.arcor-ip.net] has left #code []
12:51 MyCatSleeps is now known as MyCatVerbs
12:53 gnolam [Lenin@Nightstar-13557.8.5.253.se.wasadata.net] has joined #Code
14:24 Reiver is now known as ReivZzz
14:55 Vornicus-Latens [~vorn@67.50.40.ns-3674] has quit [Ping Timeout]
14:55 Vornicus-Latens [~vorn@67.50.40.ns-3674] has joined #code
16:08 MyCatVerbs is now known as MyCatHungers
16:17
<@ToxicFrog>
Remind me: in C, is the result of multiplying a double by an int an int?
16:17
<@ToxicFrog>
Or is it a double?
16:24
<@jerith>
It should be a double.
16:25
<@jerith>
It should translate everything to the most general type.
16:25
<@jerith>
And double is more general than int.
16:25 * ToxicFrog nods
16:25
<@ToxicFrog>
It's been a while.
16:27
<@jerith>
int i = 20;
16:27
<@jerith>
float f = 1.5;
16:28
<@jerith>
printf("%f", i*f);
16:28
<@jerith>
jerith@terminus ~/foo $ ./a.out
16:28
<@jerith>
30.000000
16:28
<@ToxicFrog>
I wonder what happened to my type-C-at-stdin script.
16:29
<@jerith>
I seem to have suddenly run our of bandwidth. :-(
16:29
<@ToxicFrog>
o.O
16:30
<@jerith>
*out
16:31
<@jerith>
This stupid fscking website which is the only way I can get bandwidth stats is somewhat out of date.
16:31
<@jerith>
And it only shows me how much I have remaining on my contract, not how much I've actually used.
16:31
<@jerith>
So I have a balance of zero.
16:32
<@jerith>
Which means I could be a couple of k over or a couple of gigs over.
16:32
<@jerith>
At R1.50/mb, that is Not Good.
16:32 AnnoDomini [~farkoff@Nightstar-28891.neoplus.adsl.tpnet.pl] has quit [Connection reset by peer]
16:33
<@ToxicFrog>
...eeew.
16:33
<@ToxicFrog>
Are you using a cellphone or something?
16:34
<@jerith>
Yes.
16:34 AnnoDomini [~farkoff@Nightstar-28891.neoplus.adsl.tpnet.pl] has joined #Code
16:34
<@jerith>
My contract gives me 500mb/month.
16:35 * Serah PatPats jerith.
16:36
<@jerith>
It's not the price that I object to. I knew that going in.
16:36
<@jerith>
It's the complete lack of any kind of tools to track my usage.
16:37
<@jerith>
And the complete lack of any kind of caring from Vodacom on the topic.
16:37
<@jerith>
How difficult is it to put a little SNMP server in the router?
17:12
<@TheWatcher>
Ah, but then people might actually know how much they've used..
17:13
<@jerith>
If you have the data card without the router, the app that they install counts usage for you.
17:14
<@jerith>
Ah, portage is *such* a pleasure to use after yum.
17:15
<@jerith>
The firmware on the router is just exceedingly shoddy.
17:15
<@jerith>
It also doesn't help that they keep changing the data card they use.
17:20 You're now known as TheWatcher[afk]
17:23
<@ToxicFrog>
Portage?
17:25
<@jerith>
Gentoo's package manager.
17:25
<@jerith>
Combines the best bits of apt and BSD's ports.
17:29
<@ToxicFrog>
Aah.
17:29 AnnoDomini [~farkoff@Nightstar-28891.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
17:30 * ToxicFrog 's experience has been that the only part of apt worth keeping is the speed~
17:35 AnnoDomini [~farkoff@Nightstar-28981.neoplus.adsl.tpnet.pl] has joined #Code
17:35
<@jerith>
TF: What do you prefer?
17:45 Vornicus-Latens is now known as Vornicus
17:57 AnnoDomini [~farkoff@Nightstar-28981.neoplus.adsl.tpnet.pl] has quit [Connection reset by peer]
17:59 AnnoDomini [~farkoff@Nightstar-28981.neoplus.adsl.tpnet.pl] has joined #Code
18:12
<@jerith>
Why is there no easy tutorial on doing network I/O in Erlang?
18:12
<@jerith>
It doesn't look that complicated. It's just that all the examples are full of other crap I don't want.
18:12
<@jerith>
And I'm not fluent enough to pick out just the bits I need yet.
18:15
< gnolam>
I should really take a look at Erlang sometime. It's supposed to be interesting to work with.
18:16
<@jerith>
It is.
18:16
<@jerith>
The little I've done so far has been fun.
18:27 MyCatHungers is now known as MyCatVerbs
18:36 MahalBEDD is now known as MahalWORK
18:46 EvilDarkLord is now known as Thokk
18:59 gnolam is now known as Tolstoy
19:00 AnnoDomini is now known as Kiers
19:00 Tolstoy is now known as gnolam
19:06 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
19:06 mode/#code [+o Chalcedon] by ChanServ
19:09 Chalcedon is now known as ChalcyGrumpy
19:12
<@ToxicFrog>
jerith: I prefer yum.
19:12
<@jerith>
!
19:12
<@ToxicFrog>
On the one hand, it's slower. On the other hand, it has a clear interface that makes it easy to find what I'm looking for, and it doesn't plunge me into Dependency Resolution Hell.
19:12 * Vornicus likes apt.
19:12
<@jerith>
I find in yum all that is wrong with package managers.
19:12
<@ToxicFrog>
Avoiding DRH is meant to be one of the main purposes of a package manager.
19:13
<@jerith>
TF: Try use Sun java on an FC6 system.
19:13
<@ToxicFrog>
Although, in fairness, most of the blame there goes to Debian's repository maintainers and not apt per se.
19:13
<@jerith>
Yum ignores interrupts half the time.
19:13
<@ToxicFrog>
Yes, that is a problem.
19:13
<@jerith>
Yum takes forever to start up because it tries to update its metadata all the time.
19:14
<@ToxicFrog>
Fortunately, it doesn't ignore SIGQUIT.
19:14
<@ToxicFrog>
alias yum='yum -C'
19:14
<@jerith>
Yum will only allow itself to run once.
19:14
<@ToxicFrog>
Or just use "yum shell", which is what I do.
19:14
<@jerith>
This includes searches, etc.
19:14
<@jerith>
Yum provides no easy way (that I can find) to pin packages at a particular version.
19:15
<@ToxicFrog>
Umm.
19:15
<@jerith>
(Yes, I need this. A lot.)
19:15
<@ToxicFrog>
By "pin" do you mean "I want this version", or "I want this version, never upgrade it unless I say otherwise"?
19:15
<@jerith>
Either.
19:15
<@ToxicFrog>
Because the former is trivially easy.
19:15
<@ToxicFrog>
package-1.2.3 rather than package.
19:16
<@jerith>
Oh, the latter then.
19:16
<@ToxicFrog>
I know of no way to do that, but I've never bothered looking.
19:16
<@jerith>
I want a yum update to not give me a newer version of package foo because the version I want has custom libraries that we build.
19:17 gnolam [Lenin@Nightstar-13557.8.5.253.se.wasadata.net] has quit [Connection reset by peer]
19:18 * ToxicFrog shrugs
19:18
<@ToxicFrog>
As I said, I've never needed that capability, so I don't know if it can be done in yum.
19:18
<@jerith>
The closest I've found is to have a separate repo with the versions I want in it and then exclude that package from all the others.
19:19
<@jerith>
Except that breaks where an update to bar wants a newer foo.
19:19
<@jerith>
Because then it refuses to do anything.
19:19
<@ToxicFrog>
At any rate, my experience is that yum is a bit sluggish, but makes it easy to find and install or remove what I need and manages all the dependencies for me cleanly.
19:19
<@ToxicFrog>
Whereas apt means three hours manually resolving and installing dependencies because it's being idiotic about python versions, then giving up and going back to yum.
19:19
<@jerith>
I've found apt(itude) to be friendly, reliable and very usable.
19:20
<@jerith>
I've never had any dependency hell.
19:20
<@ToxicFrog>
As I said, this may be more a debian repo issue than an apt issue.
19:20
<@jerith>
Oh, yum also fails to do anything if it can't get to one of its repos.
19:20
<@ToxicFrog>
However, it was certainly compounded by apt's interface, which can die in a fire.
19:21
<@jerith>
You have to explicitly disable said repo until it comes back.
19:21
<@jerith>
TF: apt operates at about the same level as rpm. You want aptitude or synaptic or something for a yum-equivalent.
19:22
<@ToxicFrog>
Well, ok, apt-get
19:22
<@ToxicFrog>
Which I'm using apt as shorthand for
19:22 * jerith nods.
19:23
<@jerith>
aptitude adds some smarts to apt-get and friends and it also gives you a curses interface which is great for finding packages.
19:23
<@jerith>
Mostly, I find myself spending more time fighting yum than working with it.
19:23 * ToxicFrog nods
19:24
<@ToxicFrog>
That exactly describes my experience with apt-get.
19:24
<@ToxicFrog>
So, I guess we'll just have to agree to disagree on this.
19:25 gnolam [Lenin@Nightstar-13557.8.5.253.se.wasadata.net] has joined #Code
19:26
< gnolam>
Hmm... I cannae remember: does atexit stuff still get called if the program exits due to a SIGINT?
19:26
<@ToxicFrog>
Don't remember either.
19:26
< Vornicus>
try it?
19:27
<@ToxicFrog>
Functions registered using atexit() (and on_exit()) are not called if a process terminates abnormally because of the
19:27
<@ToxicFrog>
delivery of a signal.
19:27
<@ToxicFrog>
from atexit(3)
19:27
<@ToxicFrog>
So, install a SIGINT handler if you want cleanup.
19:27
< gnolam>
So SIGINT isn't special-cased then? Argh.
19:28
<@ToxicFrog>
...no, why would it be?
19:33
< Vornicus>
"Selection lists are those drop-down list boxes with the built-in artificial intelligence that guarantees the choice you want can be reached only by scrolling past everyone else's choice."
19:33
<@jerith>
Indeed.
19:33 * jerith sighs at Erlang.
19:40
<@jerith>
Oh, that would be because gen_tcp live in kernel, not stdlib.
20:02
<@ToxicFrog>
Argh, working in Lua for so long has totally fucked my C reflexes
20:02
<@ToxicFrog>
struct foo = {}
20:02
<@ToxicFrog>
no semicolons
20:02 * ToxicFrog goes insane
20:04 * jerith staples Kiers to ToxicFrog's coattails.
20:04
<@jerith>
(Since you're going there anyway...)
20:05
<@jerith>
22:01 < k4y> operator presedence is just gay
20:05
<@jerith>
22:01 < k4y> why can't it know what i mean?
20:05
<@jerith>
22:01 < pjd> maybe you should switch to another "scheme"
20:05
<@jerith>
22:03 < pjd> some kind of language with Less Interfering, Suspicious
20:05
<@jerith>
Precedence
20:06
<@jerith>
(pjd is our resident lisper, in case you missed that.)
20:07
<@ToxicFrog>
(it was subtle like a sledgehammer to the face)
20:07
<@ToxicFrog>
(also, please tell me k4y was being sarcastic)
20:07
<@jerith>
He was.
20:08
<@jerith>
He's been fighting with JavaScript all evening.
20:08
<@ToxicFrog>
Aah
20:08
<@ToxicFrog>
Relay my sympathies.
20:08
<@jerith>
This particular complaint was due to shifting have lower precedence than Morris dancing.
20:09
< Vornicus>
morris dancing?
20:09
<@ToxicFrog>
Ok, why is this illegal?
20:09
<@ToxicFrog>
struct options {
20:09
<@ToxicFrog>
px_t (*scaler)(PGM *, size_t, size_t) = NULL;
20:10
<@ToxicFrog>
}
20:10
<@jerith>
Can you put assignments inside struct defs?
20:10
<@ToxicFrog>
...shit
20:11
<@ToxicFrog>
Die, C, dieeeeeeee
20:11 * jerith obediently shits.
20:11
<@jerith>
Sorry, Chalain. You may want to change your shoes now...
20:18
<@ToxicFrog>
Man, forgetting to include <stdlib.h> really messes things up.
20:18
<@jerith>
Indeed...
20:22
< Vornicus>
pff
20:26
< gnolam>
Hmm... odd. Seems my atexit /is/ being called, despite everything. I'll just put it down to "quirk with GCC" and get on with things.
21:03
< MyCatVerbs>
Error condition etiquette: is it particularly impolite for a program to die screaming, and I quote, "HOLY HELL FUCK ASS BALLS!?!?!?"
21:04
<@ToxicFrog>
...yes.
21:04
< Thokk>
Just how bad does the user need to screw up for that?
21:04
< MyCatVerbs>
Thokk: programmer, not user. =D
21:05
<@ToxicFrog>
("My theory is that a user interface should hurt. So we have sounds like 'puking', 'bird hitting window' and 'nails on blackboard'.")
21:05
<@ToxicFrog>
("But! What if the user does something wrong? In that case, we have a puking bird hitting a blackboard.")
21:29 Syloq [Syloq@Admin.Nightstar.Net] has joined #code
22:30 Kiers is now known as AnnoDomini
22:39 ReivZzz is now known as Reiver
23:08 Thokk is now known as EvilDarkLord
23:08 MyCatVerbs is now known as MyCatSleeps
--- Log closed Mon Jan 29 00:00:47 2007
code logs -> 2007 -> Sun, 28 Jan 2007< code.20070127.log - code.20070129.log >