code logs -> 2010 -> Thu, 25 Mar 2010< code.20100324.log - code.20100326.log >
--- Log opened Thu Mar 25 00:00:37 2010
--- Day changed Thu Mar 25 2010
00:00
<@ToxicFrog>
...ok, I'll give you that one, but this is what you get for using snprintf and not asprintf~
00:03
< Tarinaky>
I'm told it's a love/hate thing.
00:03
<@ToxicFrog>
Basically, my feeling is that string manipulation is liquid pain in any low level language, C and C++ included, so I might as well go with the one that gives the most control.
00:04
< Namegduf>
I hate C++ streams, personally, but thats because I dislike confusing casting.
00:04
< Namegduf>
Or overloading.
00:04
<@ToxicFrog>
And I find the *printf functions much more intuintively sensical.
00:04
< Namegduf>
Me too.
00:04
< Namegduf>
Never found anything hugely painful about the *printf functions, especially given that compiler time checks on validity are used.
00:04
<@ToxicFrog>
Also, overloading left shift to mean output/append is even more perverse than overloading + to mean concatenation.
00:04
< Namegduf>
And that, yes.
00:05
< Tarinaky>
I guess I'm just a C++ fanboi.
00:05
< Namegduf>
Is it evil to use C IO in C++?
00:05
<@ToxicFrog>
Out of curiosity, what languages have you used, Tarinaky?
00:05
< Tarinaky>
Namegduf: As long as you're consistent? No.
00:06
<@ToxicFrog>
Namegduf: I'm going to go with "no, as long as you don't mix them", but it's been years since I used C++ at all.
00:06
< Namegduf>
ToxicFrog: That's what I hoped, okay.
00:06
< Tarinaky>
ToxicFrog: C++ is the only language I have any real skill in.
00:06
< Tarinaky>
I've used variations on Pascal and played with python a little.
00:07
<@ToxicFrog>
Tarinaky: as a matter of personal curiosity I would be very interested in seeing how (or if) your thoughts on C++ shift after a year of heavy HLL use.
00:07
< Tarinaky>
And even tried Java at one point!
00:08
< Tarinaky>
ToxicFrog: The thing I find offputting about most languages is they don't look like C++ which makes it harder to spot errors.
00:08
< Tarinaky>
Which is a silly complaint I know.
00:08
< Tarinaky>
Also, for some reason xchat keeps freezing.
00:09
< Tarinaky>
May dc unexpectedly.
00:09
<@ToxicFrog>
Noted.
00:09
<@ToxicFrog>
And yeah, that's just a matter of learning to read other languages.
00:09
<@ToxicFrog>
And the more you learn, the easier it gets.
00:10
< Tarinaky>
I did have to do a project in VC++, I dunno if that counts as a different language or not.
00:10
< Tarinaky>
Probably not.
00:10
<@ToxicFrog>
It's close enough that it doesn't count as a different language for the purposes of this discussion, but different enough to make porting things between that and (say) g++ a pain in the ass.
00:11
< Tarinaky>
Managed Memory was a considerable culture shock for me.
00:11
<@ToxicFrog>
(also, note that I specifically said HLLs; I'm thinking of things like Python, Scheme, Lua, and Erlang here)
00:11
< Tarinaky>
The closest thing I've ever experienced to managed memory was when I thought it'd be a lark to implement owning pointers as a template.
00:11
<@ToxicFrog>
Managed Memory in which sense?
00:12
< Tarinaky>
VC++ has a garbage collector.
00:12
<@ToxicFrog>
Aah.
00:13
< gnolam>
Err. I assume you actually mean "Managed C++" when you write "VC++".
00:14
< Tarinaky>
I had to use some native code as well due to it being the Express edition.
00:14
< Tarinaky>
And therefor missing stuff.
00:15
< Tarinaky>
But maybe I do mean Managed instead of Visual :/
00:15
< Tarinaky>
"gas.c:1:17: error: stdio: No such file or directory" :/
00:16
< Tarinaky>
#include <stdio>
00:16
<@ToxicFrog>
stdio.h
00:16
< Tarinaky>
What am I doing wrong? >.<
00:16
< Tarinaky>
Aaaaaah
00:16
< Tarinaky>
Lol. What a newb mistake to make ^^;
00:16
<@ToxicFrog>
'man printf' (and similar) will tell you not only how to use the functions but also what #includes and #defines you need
00:17
<@ToxicFrog>
Gnar. I want to work on something but I'm not sure what.
00:18
< Tarinaky>
I've been using documentation on the C subset of C++.
00:18
< Tarinaky>
To get me through.
00:18
<@ToxicFrog>
The xchat lua plugin, maybe.
00:18
<@ToxicFrog>
Not sure I have enough brain for that tonight, though.
00:18
<@ToxicFrog>
Yeah, use the actual documentation for libc instead
00:18
<@ToxicFrog>
(assuming you are in fact using C and not C++ with C libraries)
00:18
<@ToxicFrog>
(in that case you want to #include <cstdio>)
00:18
< Tarinaky>
I'm having to use C.
00:19
< Tarinaky>
My C subset documentation is hypertext though ^^
00:19
< Tarinaky>
I know, I know, I'm spoiled. Back in your day you had to march up hill - both ways - in the snow for a man page or something.
00:19
< Tarinaky>
;)
00:20
<@ToxicFrog>
No, we just typed 'man foo', same as today :P
00:20
< Tarinaky>
Nnnnyah. >.<
00:21
< Tarinaky>
Oh wait. Ah, the library is cpgplot not just pgplot :/
00:21
<@ToxicFrog>
Anyways: http://www.acm.uiuc.edu/webmonkeys/book/c_guide/
00:21
<@ToxicFrog>
Check out chapter 2, Library, and for this specifically 2.12, stdio.h
00:22
< Tarinaky>
I've been taught all the stuff I need in workshops and stuff.
00:22
< Tarinaky>
I just, you know... haven't used it in a while :p
00:26
<@Vornicus>
Anyway, Reiver: it seems you're reasonably working on getting your LZW thingy to do its job.
00:28
< Tarinaky>
http://tarinaky.pastebin.com/cLj4CKWL << What am I doing wrong?
00:29
< Tarinaky>
Whoops, didn't include everything.
00:29
< Tarinaky>
http://tarinaky.pastebin.com/UaNKS1Qv << This one.
00:29
<@Vornicus>
The encoder and decoder are done, so the next bit is making it talk the the universe, which isn't as mindbreaking but probably a damn sight more fiddly.
00:29
< Tarinaky>
It exits every time.
00:32
<@Vornicus>
After /that/, you need packer and unpacker. I don't have those figured out yet, but essentially what you'll do is (on the one hand) take an iterable and figure out how many bits you need for each thing and shift them into a long and shift the appropriate bits into a byte and output them.
00:34
<@ToxicFrog>
Tarinaky: ok, a few issues
00:34
< Tarinaky>
Shoot away.
00:34
<@ToxicFrog>
First of all, scanf.
00:34 You're now known as TheWatcher[T-2]
00:34
<@ToxicFrog>
"s" means "read a literal s, or nothing"
00:34
<@ToxicFrog>
"%s" means "read a string"
00:35
<@ToxicFrog>
Secondly, scanf.
00:35
<@McMartin>
aie scanf
00:35
<@ToxicFrog>
If you must use it, use "%50s".
00:35
<@ToxicFrog>
As otherwise, when someone types in a 200-character-long filename, it will overflow your 50-character-long buffer and your program will, at best, crash.
00:36
<@McMartin>
Alternately, a malicious user will use this overflow to overwrite pieces of your code and take complete control of your system.
00:36
<@ToxicFrog>
Yeah. Seriously. Don't read input without bounds checking.
00:36
<@ToxicFrog>
Thirdly.
00:37
<@ToxicFrog>
Read up on 'errno', 'strerror', and 'perror'.
00:37
<@ToxicFrog>
Use them in your error reporting.
00:37
< Tarinaky>
I didn't know how to do '%50s'.
00:37
<@ToxicFrog>
Don't just say that you couldn't open the file; say what file you were trying to open, and why you couldn't open it.
00:37
< Tarinaky>
I'd like to point out that this program is only because we don't use Matlab for some reason :x
00:37
< Tarinaky>
ToxicFrog: That's overkill for this program.
00:37
<@ToxicFrog>
Is it?
00:38
<@ToxicFrog>
If you had that, you wouldn't have needed to ask
00:38
<@ToxicFrog>
Because it would have said something like:
00:38
<@ToxicFrog>
unable to open '': invalid filename
00:38 You're now known as TheWatcher[zZzZ]
00:38
<@ToxicFrog>
Or: unable to open 's': no such file or directory
00:38
< Tarinaky>
I still wouldn't have understood why xD
00:38
<@ToxicFrog>
And you would instantly realize your input code is broken.
00:38
<@ToxicFrog>
Also, even if it's not required by this project, it's a good habit to get into.
00:39
< Tarinaky>
Probably. But I'm cutting corners on the grounds that I'm not expected to know it.
00:39
< Tarinaky>
:x
00:40
<@McMartin>
C is a very, very dangerous language to cut corners in.
00:40
<@McMartin>
Secondary damage is *far* too easy.
00:40
< Tarinaky>
It's okay. I'm not running it on my own computer.
00:40
< Tarinaky>
^^
00:40
<@ToxicFrog>
...
00:40
<@McMartin>
That's not what "secondary damage" is.
00:40
<@ToxicFrog>
One moment please.
00:40 * ToxicFrog rummages around for his kneecap-poppin' stick
00:40
< Tarinaky>
:/ No! Not my fenestrates!
00:41
<@McMartin>
Namegduf: This is why I don't support teaching C until they've proven they can handle more abstract runtimes.
00:41
< Tarinaky>
Sorry. I swear I'm normally a better coder than this but I just want to get this done. Even if I do it badly.
00:41
< Tarinaky>
In truth - this course shouldn't even be in C.
00:42
< Tarinaky>
Because I'm writting a program. That plots. A graph.
00:42
< Tarinaky>
It's not doing anything a spreadsheet couldn't do better.
00:43
<@McMartin>
And every problem in C is about resource allocation and management.
00:43
<@McMartin>
If you foolishly think this is not the case, you will swiftly find that it secretly was anyway and now everything is failing apparently randomly.
00:44
< Tarinaky>
What's code 0144?
00:44
<@ToxicFrog>
...how should we know?
00:44
<@ToxicFrog>
Where are you getting it from?
00:44
< Tarinaky>
Program exited with code 0144.
00:44 * ToxicFrog shrugs. Run it in a debugger?
00:44
< Namegduf>
More accurately, to solve any problem in C, you must also solve the resource allocation and management problems of implementing it.
00:45
< Namegduf>
I find knowing C helpful for this, because very few high level languages actually remove this entirely.
00:45
< gnolam>
McMartin: honestly, I'm more for "don't teach C until you've taught computer architecture".
00:45
< Namegduf>
File descriptors being a common source of such.
00:45
< Tarinaky>
Meh. I should probably be being less reliant on you guys.
00:45
< gnolam>
(And possibly operating system design)
00:45
<@ToxicFrog>
-gnolam: "don't teach C until you've taught programming"
00:45
<@ToxicFrog>
I would consider that the bare minimum.
00:46
<@ToxicFrog>
I would support but not require your constraints.
00:46
<@ToxicFrog>
...I think.
00:47
< Tarinaky>
:x is there a way to issue a command to gdb several times?
00:47
< Tarinaky>
I want to continue through a loop 80 times. :x
00:47
< Tarinaky>
Oh wait. Nm.
00:47
<@ToxicFrog>
'step 80'
00:48
<@ToxicFrog>
Or set a watchpoint and 'continue'
00:48
< Tarinaky>
Oh wait.
00:48
<@ToxicFrog>
Or just hold down enter, which will repeat the last command entered
00:48 * Tarinaky facepalms.
00:48
< Tarinaky>
I'm an idiot.
00:56 * ToxicFrog flails
00:56
<@ToxicFrog>
I need to program, but I don't know what to program!
00:58
< Namegduf>
I'm currently having trouble recommending a decent graphical IRC client on *any* platform.
00:58
< Namegduf>
You could fix that for me. I wouldn't use it, but I'd have something to recommend.
00:58
< Tarinaky>
:/ This is a problem.
00:59
< Tarinaky>
I have no idea if my program is working because I can't get ssh to load support for X.
00:59
< Tarinaky>
This is frustrating.
00:59
< Tarinaky>
Ahh. Apparently it's Screen at fault.
01:01
<@Vornicus>
frankly the best irc client I've ever used? mIRC.
01:01
<@ToxicFrog>
Namegduf: I have consistently been entirely satisfied with xchat on linux. On windows, I was most satisfied with it out of the ones I tried, but I haven't used IRC on windows for years now, so I can't tell you if that's still the case.
01:01
< Namegduf>
mIRC has become vaguely worse
01:01
< Namegduf>
For free users, it now randomly refuses to work for a period of time and opens the "buy now" website
01:02
< Namegduf>
It has had UI changes that most people seem to consider for the worse.
01:02
<@ToxicFrog>
mIRC's scripting language would be an instant dealkiller for me even if it weren't payware with a shitty UI.
01:02
< Tarinaky>
I liked hydraIRC.
01:02
< Namegduf>
If you use HydraIRC, and don't manually /quit every time, you are choosing to spam people with its inane quit message and should probably get glined
01:03
< Namegduf>
Which summarises my view on that client, I think.
01:03
< Tarinaky>
The quit message sucks.
01:03
< Tarinaky>
But it's still a good client.
01:03
< Tarinaky>
And, tbh, quit messages are always inane.
01:04
< Namegduf>
They're not,however, always spam.
01:04
<@ToxicFrog>
Anyways, in summary: unqualified recommendation for xchat on linux. Qualified recommendation for xchat on windows. No recommendation for OSX since I don't use it.
01:04
< Namegduf>
That's like saying "It randomly sends out spam to everyone on my contact list, but it's a good mail client."
01:04
< Tarinaky>
I don't think it's quite the same thing.
01:04
< Namegduf>
It is.
01:04
< Tarinaky>
Besides, you could just edit the exe and replace the quit messge.
01:04
< Tarinaky>
*message
01:05
< Tarinaky>
It's been a while since I used it though.
01:05
<@Vornicus>
OSX the only one that was even vaguely okay was X-Chat Aqua, and that blows too for a variety of reasons.
01:05
< Namegduf>
That's no justification for the behaviour of the released client, but that would be an acceptable alternative to manually entering /quit
01:05
<@Vornicus>
Not least of which is "no updates in 3 years"
01:06
< Namegduf>
People are telling me I should recommend Quassel.
01:06
< Tarinaky>
Didn't someone say they needed to program something but didn't know what?
01:06
<@Vornicus>
TF did.
01:06
< Tarinaky>
ToxicFrog: You should totally write an IRC client ^^
01:06
< Orth>
snrk. Boring.
01:07
<@Vornicus>
TF: a cli uplink clone.
01:07
< Orth>
... However, if TF has spare braincycles spare, I have a Fun Project I was pondering attempting later.
01:07
<@Vornicus>
Tarinaky: TF, iirc, has /written/ an irc client. in PostScript.
01:07
< Tarinaky>
Oh.
01:07
< Tarinaky>
ToxicFrog: My homework?
01:07
< Orth>
It involves... postscript, well that's convinient
01:07
<@Vornicus>
(I am pretty sure I'm better at actually /drawing/ with PostScript than TF, though)
01:08 * Orth was pondering the other day, a way to take a simple ASCII map and have it get crafted on a grid. Such that you can simply ask for http://whatever.com/image.png and /have it there/.
01:09
<@Vornicus>
Orth: I've done it with Python Imaging Library.
01:09
< Orth>
... What, already?
01:09
<@Vornicus>
Yeah.
01:10 * Orth stares. So you can input something like (fixedwith font)
01:10
< Orth>
...T..
01:10
< Orth>
b..j..
01:10
< Orth>
..e..T
01:10
<@Vornicus>
Well, okay, not through a website
01:10
<@Vornicus>
but that's the trivial part!
01:10
< Orth>
And then link straight to the image and have it make a usable .png that can be linked to?
01:10
<@Vornicus>
Sure, can be done.
01:10
< Orth>
Huh. That's surprisingly awesome.
01:11
<@Vornicus>
Hard part is all the damn art.
01:11
< Tarinaky>
I don't suppose anyone knows PGPlot? :/
01:11
< Orth>
It had been a Project I had pondered for online gaming, where often you want to be able to have a quick simple map layout, then update that layout without "Modify image, upload image, find URL, pass out URL, /repeat/"
01:11
< Orth>
And more readable than ASCII maps, which a lot of folks really don't like. >_>
01:12
< Orth>
Hn. Art can be worked on. Bonus points if... hey, can Postscript include pictures? As textures or whatever?
01:14
<@ToxicFrog>
You can include bitmaps in a postscript file, yes
01:15
<@Vornicus>
I find it prettier to make your own vector art, which I've done.
01:16
<@Vornicus>
An important caveat: ps doesn't know anything about alpha channel.
01:16
< Tarinaky>
Using C io how would I match and disgard whitespace?
01:16
<@Vornicus>
or about transparency layer like in gif.
01:16
< Tarinaky>
"[ ,\n]*" or whatever the regexp is :/
01:17
<@Vornicus>
Which makes vectors even /more/ preferable.
01:17
< Orth>
Hm.
01:17
< Orth>
Is there any way at all to get a non-square hunk of bitmap showing?
01:18
<@ToxicFrog>
Tarinaky: in *scanf, I believe any whitespace will match all whitespace
01:18
<@ToxicFrog>
But don't trust me, read the man page
01:18
< Tarinaky>
Cheers.
01:20
< Tarinaky>
Manual says yes. It's unclear though... Does it mean " %e" would skip whitespace then read a float?
01:20
< Tarinaky>
Or am I missing something?
01:21
<@ToxicFrog>
Sounds right.
01:22
< Tarinaky>
Still doesn't seem to be working :/
01:22
< Tarinaky>
Oh!
01:22
< Tarinaky>
Of course.
01:24
< Tarinaky>
I need to skip to the first New Line character in the document.
01:24
< Orth>
Vorn: That sounds like a fun project to attempt once I'm done with all this codin' stuff. Hmm.
01:24
< Orth>
We should, uh, probably get on with the coding stuff though. >_>
01:25
< Tarinaky>
Any suggestions on how I can disregard the first line of my datafile? :/
01:25 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
01:25
< Tarinaky>
I'm not seeing anything appropriate in the manual.
01:26
<@ToxicFrog>
Look at the * modifier to scanf, or just read it into a buffer and ignore it, or read it character by character until you hit \n...
01:32 * Orth hits up how to do Java IO; it's been a while.
01:32 * Tarinaky boggles.
01:33
< Tarinaky>
fscanf just threw a segfault. feof is 0, I'm not overflowing my buffer...
01:33
<@ToxicFrog>
gdb.
01:33
< Tarinaky>
I am in gdb.
01:33
< Tarinaky>
This is how I know I'm not overflowing my buffer.
01:34
< Tarinaky>
The control variable for the loop is 0. It won't overflow until it reaches 100 (which shouldn't happen)
01:35
< Tarinaky>
fscanf(f," %e",aTable[iRecords].Volume);
01:35
< Tarinaky>
I'm a little puzzled and unsure what to consider next.
01:35
< celticminstrel>
...what's %e?
01:35
<@McMartin>
You're writing into a non-pointer.
01:35
< celticminstrel>
Oh, wait, that's a float, right?
01:35
<@McMartin>
&aTable[iRecords].Volume
01:36
< Tarinaky>
Thank you.
01:36
< Tarinaky>
>.>
01:36
< celticminstrel>
My advice: compile with -Wall.
01:36
< celticminstrel>
GCC warns you of these things.
01:36
< Tarinaky>
Yeah. I'm used to G++ which would have warned me of that anyway >.<
01:36
< celticminstrel>
It does, if you tell it to.
01:36
< Tarinaky>
Plus it gets damn hard to remember all the flags I'm meant to be using for this :/
01:37
< celticminstrel>
Just go with -Wall, and you don't need to remember all the warning flags. ;)
01:37
< Tarinaky>
I meant the linker flags.
01:37
< gnolam>
-Wall -O2 (yes, telling GCC to optimize will cause to do even more checking for dodgy code).
01:37
< Tarinaky>
For the library we have to use.
01:37
< gnolam>
+it
01:38 celmin [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
01:39
< gnolam>
(For instance: unused variables)
01:40 * Tarinaky headdesks.
01:40
< Tarinaky>
It's reading nulls into my structure.
01:40
< celticminstrel>
Um, what?
01:41
< Tarinaky>
print (char)(aTable[3].Volume)
01:41
< Tarinaky>
$16 = 0 '\0'
01:42
<@Vornicus>
Reiv: it'd be a good project I think but the thing is you should either use actual vector graphics or PIL.
01:43
<@ToxicFrog>
Tarinaky: if you're having trouble remembering all the flags, use a makefile or pmfile.
01:43
<@ToxicFrog>
Which you should be doing anyways.
01:44
< Tarinaky>
I tried that. But Make and cpgplot had an argument.
01:44
< Tarinaky>
They're currently on a trial seperation.
01:46
< Tarinaky>
" %e" should match -all- white space right?
01:46
< Tarinaky>
Or do I have to explicitly list every kind of whitespace in every conceivable combination?
01:46
< Tarinaky>
Wait a second...
01:47
< Tarinaky>
No, nm. That was a silly idea.
01:47
<@ToxicFrog>
Read the documentation, and it will tell you
01:47
< Tarinaky>
I did. It was unclear.
01:47
< Tarinaky>
:/
01:48
< Tarinaky>
" A sequence of white-space characters (space, tab, newline, etc.; see isspace(3)). This directive matches any amount of white space, including none, in the input"
01:49
< Tarinaky>
I'm clutching at straws trying to figure out why I'm not getting what I expect out of scanf.
01:53
< Tarinaky>
It's just reading out nulls.
01:54
<@ToxicFrog>
...what's unclear about it, and what's your input data and your code?
01:54
< celticminstrel>
I don't suppose null would count as a whitespace? (Probably not...)
01:55
< Tarinaky>
What's unclear is I don't see why it's filling my table with 21 rows of \0.
01:55 * Tarinaky puts his code and data on a pastebin.
01:56
< Orth>
Vorn: The only reason bitmaps are demanded is because it is common for people to want their characters face on a token for combat.
01:56
<@ToxicFrog>
celticminstrel: in long, see isspace(3). In short, no.
01:56
< Orth>
The terrain can be vector'd, but the tokens will likely still want bitmaps because they're What You Find On The Internet.
01:56
< Tarinaky>
http://tarinaky.pastebin.com/Pwh5J1sG
01:57
< celticminstrel>
Thought not.
01:57
< Tarinaky>
Orth: I tend to use scans of dungeon tiles for terrain.
01:58
<@ToxicFrog>
Orth: why postscript for this?
01:58
< Orth>
Tarinaky: Yeah, but that means you have to break out an image editor and a file uploader to get a link.
01:59
< Orth>
ToxicFrog: Is there a better way to dynamically create graphics? I had understood postscript was pretty awesome for that kind of thing.
02:00
<@ToxicFrog>
Tarinaky: does your data have leading spaces as it's presented in the pastebin?
02:00
< Tarinaky>
ToxicFrog: Yes.
02:00
<@ToxicFrog>
Orth: if you're just stitching together bitmaps, imagemagick does that quite handily
02:00
<@ToxicFrog>
And IIRC is available in library form
02:01
<@ToxicFrog>
Tarinaky: also, why are you using scanf "%c" and not, say, fgetc to read characters?
02:01
< Orth>
TF: I admit large quantities of ignorance in these matters.
02:02
< Tarinaky>
ToxicFrog: Because I went with the first thing that popped into my head.
02:02
< Tarinaky>
As far as I can tell, through stepping through the loop, it works.
02:02
< Tarinaky>
Although I need to add a !feof(f) to stop an infinite loop I just notice.
02:04 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
02:07
<@ToxicFrog>
Tarinaky: a quick test on my end implies that it should work
02:07
< Orth>
hmm.
02:08
<@ToxicFrog>
...oh hey
02:08
< Orth>
I'm dealing with bytestreams and InputStreams
02:08
<@ToxicFrog>
Tarinaky: look at your struct definition.
02:08
<@ToxicFrog>
Then, look at what data type %f (and by extension %e) expects in scanf.
02:08
< Orth>
I take it this is a good time to do a simple ByteStream for file IO?
02:09
< Tarinaky>
... Isn't there an implicit upcast?
02:09
< Orth>
http://java.sun.com/docs/books/tutorial/essential/io/bytestreams.html
02:09
< Tarinaky>
I mean, there wasn't a double listed in the manual :/
02:09
< celticminstrel>
Use %le for double.
02:10
< celticminstrel>
(Or %lf, %lg, etc).
02:10
<@ToxicFrog>
Tarinaky: implicit upcast in scanf? ahahahahaha
02:10
<@ToxicFrog>
It gets a pointer.
02:10
<@ToxicFrog>
You have told it that this pointer is a pointer to a float.
02:10
< celticminstrel>
scanf has no idea what type of arguments it is receiving.
02:10
< Tarinaky>
Pointers have types to- Oh wait... In C they don't do they?
02:10
<@ToxicFrog>
It has no way whatsoever of verifying this.
02:11
< Tarinaky>
:/
02:11
< celticminstrel>
Yes they have types, Tarinaky, but...
02:11
<@ToxicFrog>
scanf is a varargs function.
02:11
<@ToxicFrog>
Varargs functions in C are basically untyped.
02:11
< celticminstrel>
...when you pass through a variable argument list, it forgets what the types were.
02:11
<@ToxicFrog>
All it has to go on is the format string you passed it as the first argument.
02:11
< Tarinaky>
C is a very silly language :/
02:11
<@ToxicFrog>
If that doesn't match the rest of the arguments, it has no way of telling.
02:11 Attilla [Attilla@FBC920.482E2D.82B33A.EBFF0B] has quit [[NS] Quit: ]
02:12
<@ToxicFrog>
You told it that you were passing it a float * and actually passed it a double *? Too bad. It's going to treat the first four bytes after that pointer as a float, because you told it that's what it was.
02:12
< Tarinaky>
I still don't see why it came out as \0.
02:12
< Tarinaky>
Why not something more purplexing?
02:12
< Namegduf>
Competent compilers will warn of this if the format string is constant.
02:13
< Namegduf>
(That is, GCC with decent flags will)
02:13
< celticminstrel>
Didn't I mention -Wall? Use it! Now!
02:13
< Tarinaky>
I was using Wall.
02:13
< Tarinaky>
I thought it was just being over cautious.
02:13
<@ToxicFrog>
...
02:13
< Tarinaky>
>.>
02:14
<@ToxicFrog>
Kneecap poppin' time again
02:14
< Tarinaky>
Yessir.
02:14
< Namegduf>
Never, ever ignore warnings until you know of "what worrisome sign they speak"
02:14
< celticminstrel>
Generally when you get a warning you should heed it.
02:14
< Namegduf>
Warnings are the compiler saying that in its expert view, "that code looks wrong"
02:14
< Tarinaky>
I thought there was an implicit up cast!
02:14
< Tarinaky>
I don't even know what a vararg function is >.> I'm not a C coder.
02:14
< celticminstrel>
How can it upcast if it has no idea what type you passed in apart from the format string you passed?
02:15
< Tarinaky>
I didn't know it had no idea!
02:15
< Tarinaky>
Honest!
02:15
< Tarinaky>
>.<
02:15
< celticminstrel>
Well, that's true of all the print/scan functions.
02:15
< celticminstrel>
Any function that has '...' in the argument list, in fact.
02:15
<@ToxicFrog>
Tarinaky: a vararg function is one where rather than having a fixed set of arguments, ithe argument list ends with ...
02:15
<@ToxicFrog>
printf, for example, has signature (const char *, ...) -> int
02:16
<@ToxicFrog>
What this means is "it takes as arguments a const char *, plus whatever else the caller feels like putting on the stack"
02:16
< Tarinaky>
Right.
02:16
<@ToxicFrog>
The only way it can tell what the caller put on the stack is by what they said they did in the format string.
02:16 * Tarinaky is currently trying to work out why it's still not graphing anything :/
02:17
< celticminstrel>
Did you change the format string to use %le for double?
02:17
<@ToxicFrog>
This is the case for any varargs function; the callee has no way of finding out what the caller put on the stack. It just has to trust the caller followed the rules and, if applicable, gave it the right information.
02:17
< Tarinaky>
celticminstrel: Yes.
02:17
<@ToxicFrog>
Erm
02:17
<@ToxicFrog>
According to my man page, it's L
02:17
<@ToxicFrog>
l and ll are only for ints and strings, L is for doubles.
02:17
< Tarinaky>
%le worked.
02:17
< celticminstrel>
Really?
02:18
< Tarinaky>
Even -Wall accepted it.
02:18
< celticminstrel>
I'm pretty sure I've used %lf before for doubles.
02:18
<@ToxicFrog>
-Wall accepted it; are the right values going into your array?
02:18
< Tarinaky>
Yes.
02:18
< Namegduf>
Don't rely on -Wall that way.
02:18
<@ToxicFrog>
Alright then.
02:18
< celticminstrel>
...wait. How is l and ll used for strings?
02:18
< celticminstrel>
Or what does it mean?
02:18
< Namegduf>
In general, the compiler only occasionally helps you with specific API functions for common stuff, and doesn't try to know ALL their issues.
02:19
< Tarinaky>
celticminstrel: Wide characters?
02:19
< Namegduf>
It's quite possible that if it doesn't recognise a format string parameter, it would quietly ignore it.
02:19
< Tarinaky>
Namegduf: I said it worked first.
02:19
< celticminstrel>
I suppose... though there's a separate set of functions for wide characters, right?
02:19
< Tarinaky>
If it works it works.
02:20
< celticminstrel>
I wouldn't be surprised if it's mostly case-insensitive... though I wouldn't rely on that.
02:23
< Tarinaky>
If only the booklet they gave us included documentation for the barely passable library we have to use :/
02:24
<@ToxicFrog>
celticminstrel: yes, wide strings
02:24
< celticminstrel>
What library?
02:24
< Tarinaky>
cpgplot
02:24
< Tarinaky>
I'm having to work out the arguments for the functions it uses in the booklet by trial and error.
02:25
< celticminstrel>
ToxicFrog: But shouldn't you use wscanf and wprintf if you're working with wide strings?
02:26
< celticminstrel>
Tarinaky: Would it be possible to open up the header files to check the arguments needed?
02:26
< Tarinaky>
celticminstrel: Hadn't thought of that.
02:26
<@ToxicFrog>
celticminstrel: shrug? it says ls and lc are for wchar_t rather than char.
02:26
<@ToxicFrog>
Also, I was wrong, l is totally correct for %f
02:26
< Tarinaky>
celticminstrel: No idea how I'm supposed to make two graphs with this thing though.
02:31
< Tarinaky>
Ahah!
02:39 * Tarinaky digs out his leg-crushing text book on physics.
02:53
< Tarinaky>
:/ I need to approximate from my data a value of g from PV^g=k where k is an unknown constant.
02:54
< Tarinaky>
I guess simultaneous equations... but then I'm not really sure how to use the rest of the data to improve my accuracy.
02:54
< Tarinaky>
Suggestions?
03:31 celmin [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [Client exited]
03:32 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: *hums* Can't stay now!]
05:17 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
06:15 ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has quit [Operation timed out]
06:17 SmithKurosaki [Smith@Nightstar-b74e42f9.dsl.teksavvy.com] has quit [Ping timeout: 121 seconds]
06:19 SmithKurosaki [Smith@Nightstar-2f078325.dsl.teksavvy.com] has joined #code
06:35 AnnoDomini [annodomini@Nightstar-4cb682d6.adsl.tpnet.pl] has joined #code
06:35 mode/#code [+o AnnoDomini] by Reiver
07:13 Rhamphoryncus [rhamph@Nightstar-8931f88f.abhsia.telus.net] has quit [Client exited]
08:08 AnnoDomini [annodomini@Nightstar-4cb682d6.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
08:08 AnnoDomini [annodomini@Nightstar-4cb682d6.adsl.tpnet.pl] has joined #code
08:08 mode/#code [+o AnnoDomini] by Reiver
08:20 AbuDhabi [annodomini@Nightstar-6232238e.adsl.tpnet.pl] has joined #code
08:22 AnnoDomini [annodomini@Nightstar-4cb682d6.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
08:25 AbuDhabi [annodomini@Nightstar-6232238e.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
08:25 AnnoDomini [annodomini@Nightstar-6232238e.adsl.tpnet.pl] has joined #code
08:25 mode/#code [+o AnnoDomini] by Reiver
09:29 You're now known as TheWatcher
09:52 Orthia [orthianz@Nightstar-d5a09177.xnet.co.nz] has joined #code
09:55 Orth [orthianz@Nightstar-29730e5d.xnet.co.nz] has quit [Ping timeout: 121 seconds]
10:49 Attilla [Attilla@FBC920.482E2D.82B33A.EBFF0B] has joined #code
10:49 mode/#code [+o Attilla] by Reiver
11:12 RichardBarrell [user@Nightstar-58acb782.cable.virginmedia.com] has joined #code
11:26 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
11:26 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [Client exited]
11:46 RichardBarrell [user@Nightstar-58acb782.cable.virginmedia.com] has quit [Client closed the connection]
12:14 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
12:23 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed]
13:01 celticminstrel [celticminstre@1AB00B.855209.A256BB.B16D09] has joined #code
13:09 celticminstrel [celticminstre@1AB00B.855209.A256BB.B16D09] has quit [Client exited]
13:41 RichardBarrell [user@Nightstar-58acb782.cable.virginmedia.com] has joined #code
13:53 celticminstrel [celticminstre@1AB00B.855209.A256BB.B16D09] has joined #code
13:56 celticminstrel [celticminstre@1AB00B.855209.A256BB.B16D09] has quit [Client exited]
14:02 AnnoDomini [annodomini@Nightstar-6232238e.adsl.tpnet.pl] has quit [[NS] Quit: Assembly programming. Back later.]
14:06 celticminstrel [celticminstre@1AB00B.855209.A256BB.B16D09] has joined #code
14:20 * TheWatcher has decided that he Realy Likes Flyspray.
14:20
<@TheWatcher>
+l
14:20
<@TheWatcher>
So much easier to work with than Bugzilla, for a start
14:27
< Tarinaky>
How can I concatenate a string in C?
14:27
< Tarinaky>
I need to annotate my plot with my name, the date and some calculated values. :x
14:27
< celticminstrel>
strcat
14:29
< gnolam>
But please make it a habit to use the safe functions. In this case strncat.
14:30
< celticminstrel>
...yeah, what he said is good.
14:32
<@TheWatcher>
Or you could use snprintf() if you are including numbers you'd otherwise need to shove into buffers and then strncat
14:35 DBot [Reiver@Nightstar-019bfb55.xnet.co.nz] has joined #code
14:37 DiceBot [Reiver@Nightstar-019bfb55.xnet.co.nz] has quit [Ping timeout: 121 seconds]
14:37
< Tarinaky>
gas.c:101: warning: passing argument 1 of cpgmtxt makes pointer from integer without a cast << I don't understand this error.
14:37
< Tarinaky>
The prototype for the function (according to the manual) is: void cpgmtxt(const char *side, float disp, float coord, \
14:37
< Tarinaky>
float fjust, const char *text);
14:38
< Tarinaky>
What pointer?
14:38 DBot is now known as DiceBot
14:38
< celticminstrel>
const char*
14:38
<@TheWatcher>
the first argument should be a pointer, you are apparently giving it an integer
14:38
< celticminstrel>
WHat are you actually passing>
14:38
< celticminstrel>
?
14:38
< Tarinaky>
Oh. I see the problem. I only used single ''s instead of ""
14:39
< celticminstrel>
That would be it.
14:46 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
14:47 AnnoDomini [annodomini@Nightstar-6232238e.adsl.tpnet.pl] has joined #code
14:47 mode/#code [+o AnnoDomini] by Reiver
15:40 celticminstrel [celticminstre@1AB00B.855209.A256BB.B16D09] has quit [Ping timeout: 121 seconds]
15:40 celticminstrel [celticminstre@1AB00B.855209.A256BB.B16D09] has joined #code
15:40
< celticminstrel>
Right?
15:41
< Namegduf>
"So does the word algorithm have anything to do with Al Gore?"
15:41
< celticminstrel>
XD
15:41
< Namegduf>
*facedesks around the room*
15:42 ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has joined #code
15:42 mode/#code [+o ToxicFrog] by Reiver
16:01 Tarinaky [Tarinaky@Nightstar-b6e9a965.adsl.virginmedia.net] has quit [Ping timeout: 121 seconds]
16:04
< gnolam>
Namegduf: Haha
16:09 Tarinaky [Tarinaky@Nightstar-b5c30d2f.adsl.virginmedia.net] has joined #code
16:09
< Tarinaky>
<Namegduf> "So does the word algorithm have anything to do with Al Gore?" << Who said that? :/
16:11
< Namegduf>
Tarinaky: Someone in one of my lectures. Everyone laughed.
16:12
< Namegduf>
Well, no, some people did.
16:13
<@TheWatcher>
Of course it does; he invented them all!~
16:13
< Tarinaky>
He built Donald Knuth to help his mother when he was still child before being rescued by Jedi.
16:14 celticminstrel [celticminstre@1AB00B.855209.A256BB.B16D09] has quit [Client exited]
17:12
< Tarinaky>
What? Not even a lol? :(
17:12 * Tarinaky feels unloved.
17:14 * PinkFreud gives Tarinaky a wimper
17:14
< PinkFreud>
sorry, that's all I'm willing to do
17:35 Rhamphoryncus [rhamph@Nightstar-8931f88f.abhsia.telus.net] has joined #code
18:21
< gnolam>
... dammit. Brain damage.
18:21
< gnolam>
The song I was listening to (Shpongle - Mentalism) has a sample of a crackling Geiger counter. My first instinct was to go "Where? Where!?" and immediately distance myself from the source. :P
18:53
<@Vornicus>
gnolam: played too much Government Radiation Event Training SImulator?
19:00
< gnolam>
It's sort of inevitable when you're both developer and lead tester. :P
19:00
< gnolam>
(And by lead I mean "chief". I wouldn't want to be the one testing the radiation shielding. ;))
19:07 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [[NS] Quit: The world is so funny sometimes; I often forget to laugh.]
19:09 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
19:40 Reiver [reaverta@5B433A.77CB96.0CB44B.7B40FA] has quit [Ping timeout: 121 seconds]
19:40 Reiver [reaverta@ServerAdministrator.Nightstar.Net] has joined #code
19:40 DBot [Reiver@Nightstar-019bfb55.xnet.co.nz] has joined #code
19:40 mode/#code [+qo Reiver Reiver] by ChanServ
19:41 Orthia [orthianz@Nightstar-d5a09177.xnet.co.nz] has quit [Ping timeout: 121 seconds]
19:41 Orthia [orthianz@Nightstar-d5a09177.xnet.co.nz] has joined #code
19:42 DiceBot [Reiver@Nightstar-019bfb55.xnet.co.nz] has quit [Ping timeout: 121 seconds]
19:42 DBot is now known as DiceBot
19:50 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
19:57
<@McMartin>
I love how glibc's build instructions boil down to "don't"
20:04
< Namegduf>
Sounds like Drepper's attitude.
20:04
<@McMartin>
Who?
20:04
<@McMartin>
I mean, they have good reasons for it, viz. "you're going to get the ABI wrong and that will break everything, use your distro version", but
20:04
< Namegduf>
Head maintainer of Glibc, most known for committing things that change semantics that break things like "Firefox"
20:05
< Namegduf>
And then refusing to explain why on the bugtracker.
20:05
<@McMartin>
Pah. Who uses niche apps like that?
20:06
< Namegduf>
http://sourceware.org/bugzilla/show_bug.cgi?id=4980
20:06
<@McMartin>
Fantastic
20:06
< Namegduf>
First reply: "Of course it gains something, otherwise it would not have been added. And programs which don't handle multiple addresses are simply broken and must be fixed. Stop defending broken code."
20:07
< Namegduf>
"Stop reopening bugs. Search the web if you want an explanation, I don't have anything handy and certainly have no interest in writing it up."
20:08
< Namegduf>
It hit Slashdot, which is why you start seeing posts from "Osama bin Drepper"
20:59 * PinkFreud screams
20:59
< Alek>
ugh.
20:59
< Alek>
hm.
20:59
< Alek>
Omega can't run on here cause the executable is 32-bit.
20:59
< Alek>
think the source can be recompiled to be 64-bit compatible, if I grab the source?
20:59
< PinkFreud>
*$!*$@% Apple and their @*%@(# insistence on providing customized java releases and #*@*%(#$ Filemaker and their #*@%@&*#% buggy-ass code
21:00
< Namegduf>
If you're not going to support 64bit, can't they please build it statically?
21:01
< Namegduf>
Apple's Java doesn't work?
21:02
< PinkFreud>
http://fm.lithium.com/t5/Report-a-bug/FMS9-Admin-on-10-6/m-p/38422 is my problem in a nutshell
21:02
< PinkFreud>
FM is too asinine to support anything newer than Java 6 update 7
21:03
< PinkFreud>
Apple, though, has it's own problems - like the fact that java web start apps completely ignore the java preferences settings.
21:03
< PinkFreud>
*supposedly*, javaws apps are supposed to get the preferred version of java to launch from prefs.
21:04
< PinkFreud>
in reality, they simply launch with the latest version available, and damn the preferences.
21:06
< Alek>
well.
21:06
< Alek>
found a windoze port elsewhere.
21:06
< Alek>
(got the msdos port originally)
21:06
< Alek>
but it makes graphics glitches.
21:09
< Alek>
and finally, a third version, tiled. now this works fine.
21:23 AnnoDomini [annodomini@Nightstar-6232238e.adsl.tpnet.pl] has quit [[NS] Quit: Gnar.]
22:33
<@ToxicFrog>
Omega?
22:44 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has quit [Client closed the connection]
22:56 GeekSoldier [Rob@Nightstar-e86e3e0d.ip.cablemo.net] has joined #code
23:36 You're now known as TheWatcher[T-2]
23:38 You're now known as TheWatcher[zZzZ]
--- Log closed Fri Mar 26 00:00:46 2010
code logs -> 2010 -> Thu, 25 Mar 2010< code.20100324.log - code.20100326.log >