code logs -> 2010 -> Tue, 30 Nov 2010< code.20101129.log - code.20101201.log >
--- Log opened Tue Nov 30 00:00:09 2010
--- Day changed Tue Nov 30 2010
00:00
< celticminstrel>
I don't much like curses, but it does seem to be the console library for C/C++.
00:00
<@McMartin>
std::string has a method c_str() that gives you a const char* for the instant contents of the string; the pointer invalidates as soon as you do anything else with the string but it's usually good enough.
00:00
<@McMartin>
for input, you need an array or a std::vector<char> and then use it as the constructor argument for a std::string.
00:01
< celticminstrel>
...wait, what?
00:02 * AnnoDomini vaguely remembers needing to write... itoa() or atoi(), can't remember which, but one of these was despicably absent for some reason from the standard libraries.
00:03
< celticminstrel>
Also, I guess c_str() would be a problem if the function saves the pointer somewhere for future use (ie the docs say that the function will be responsible for freeing the string)... but that's more common with non-strings, I think.
00:03
< celticminstrel>
One of itoa and atoi (I think the former) is a Microsoft extension.
00:03
< gnolam>
AnnoDomini: stringstream takes care of string => some kind of value conversions.
00:03
< celticminstrel>
The standard way, though, is that ^
00:03
< AnnoDomini>
gnolam: I used it in my conversion function.
00:04
< gnolam>
That should've been <=>, BTW.
00:04
< celticminstrel>
....what?
00:04
< celticminstrel>
Oh, right.
00:05
< gnolam>
As in, it converts both ways. :)
00:05
< celticminstrel>
The only annoying thing about input streams is that you can't do something like cin >> "abc" and have it skip the next characters only if they match "abc".
00:06
<@ToxicFrog>
AnnoDomini: atoi() is for converting strings to ints. The latter is missing because sprintf() renders it entirely superfluous.
00:06
< celticminstrel>
But Boost.Spirit provides that, I guess, so it's not really a problem.
00:29 Attilla [Some.Dude@Nightstar-8bcd39e8.threembb.co.uk] has quit [[NS] Quit: ]
01:03 AnnoDomini [annodomini@Nightstar-42db73b9.adsl.tpnet.pl] has quit [[NS] Quit: Time for sleeping.]
01:06 Derakon[AFK] is now known as Derakon
01:07 You're now known as TheWatcher[T-2]
01:12 You're now known as TheWatcher[zZzZ]
01:18
< gnolam>
The biggest caveat of stringstreams is that they're affected by locale.
01:20
< gnolam>
Well, all of C++'s streams, really.
01:31 Vornicus-Latens is now known as Vornicus
01:37
<@Vornicus>
gah, 40 lines of code in one function = weeping.
01:38
<@Vornicus>
I don't care if it's technically view code, it shouldn't need to do this much.
02:23 Stalker [Stalker@26ECB6.A4B64C.298B52.D80DA0] has quit [Ping timeout: 121 seconds]
02:57 * gnolam notices that Go-OO's installer retains OO.org's complete lack of knowledge of temporary file directories.
03:09
< gnolam>
Also: still full of fail.
03:14 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
03:33 kwsn [kwsn@Nightstar-ca9721ae.dyn.centurytel.net] has joined #code
03:55 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
04:23 Rhamphoryncus [rhamph@Nightstar-473f8685.abhsia.telus.net] has quit [Ping timeout: 121 seconds]
04:31 Rhamphoryncus [rhamph@Nightstar-473f8685.abhsia.telus.net] has joined #code
05:19 cpux is now known as shade_of_cpux
05:30 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Client closed the connection]
05:38 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
06:13 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
06:36 Derakon is now known as Derakon[AFK]
08:05 kwsn is now known as kwsn\t-2
08:06 kwsn\t-2 [kwsn@Nightstar-ca9721ae.dyn.centurytel.net] has quit [[NS] Quit: BEEP BEEP IMMA JEEP]
08:43 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection closed]
08:47 Anno[Laptop] [annodomini@Nightstar-cefeb0f7.adsl.tpnet.pl] has joined #code
09:01 Vornicus is now known as Vornicus-Latens
09:24 You're now known as TheWatcher
10:03 Anno[Laptop] [annodomini@Nightstar-cefeb0f7.adsl.tpnet.pl] has quit [[NS] Quit: leaving]
10:42 Anno[Laptop] [annodomini@F67919.F326B3.98D923.BDA7B6] has joined #code
11:32 Ortiha [orthianz@Nightstar-8b649251.xnet.co.nz] has joined #code
11:35 Orthia [orthianz@Nightstar-77ad062a.xnet.co.nz] has quit [Ping timeout: 121 seconds]
11:59 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
12:34 Ortiha [orthianz@Nightstar-8b649251.xnet.co.nz] has quit [Ping timeout: 121 seconds]
12:56 Orthia [orthianz@Nightstar-63170410.xnet.co.nz] has joined #code
13:03 Anno[Laptop] [annodomini@F67919.F326B3.98D923.BDA7B6] has quit [[NS] Quit: BLARGH.]
13:27 Orthia [orthianz@Nightstar-63170410.xnet.co.nz] has quit [Ping timeout: 121 seconds]
13:31 Orthia [orthianz@Nightstar-ef7d7721.xnet.co.nz] has joined #code
13:33 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has joined #code
13:33 Reiver [reaverta@ServerAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
13:36 DBot [Reiver@Nightstar-f869f66e.xnet.co.nz] has joined #code
13:37 Anno[Laptop] [annodomini@Nightstar-cefeb0f7.adsl.tpnet.pl] has joined #code
13:38 DiceBot [Reiver@Nightstar-7bfad333.xnet.co.nz] has quit [Ping timeout: 121 seconds]
13:38 Reiver [reaverta@ServerAdministrator.Nightstar.Net] has joined #code
13:38 mode/#code [+qo Reiver Reiver] by ChanServ
13:38 DBot is now known as DiceBot
13:42 TarinakyKai [Tarinaky@Nightstar-f349ca6d.plus.com] has joined #code
13:42 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has quit [Ping timeout: 121 seconds]
15:12 Stalker [Stalker@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
17:02 simon_ [simon@Nightstar-a12ff716.gjk.dk] has joined #code
17:02
< simon_>
what are these illustrations called? http://sqlite.org/lang.html
17:06
<@TheWatcher>
syntax diagram (sometimes a "railroad diagram")?
17:16 TarinakyKai [Tarinaky@Nightstar-f349ca6d.plus.com] has quit [Ping timeout: 121 seconds]
17:17 Attilla [Some.Dude@Nightstar-d0c6737e.threembb.co.uk] has joined #code
17:17 mode/#code [+o Attilla] by Reiver
17:18 Attilla is now known as Prophet
17:20 Anno[Laptop] is now known as Swillin`
17:26
< simon_>
yeah, that'll do. thanks. :)
17:27
< simon_>
bbl
17:35 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has joined #code
18:16 Alek [omegaboot@Nightstar-96006922.il.comcast.net] has quit [Ping timeout: 121 seconds]
18:22 Alek [omegaboot@Nightstar-96006922.il.comcast.net] has joined #code
20:10 Serah [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
20:50 Orthia [orthianz@Nightstar-ef7d7721.xnet.co.nz] has quit [Client closed the connection]
20:55 Rhamphoryncus [rhamph@Nightstar-473f8685.abhsia.telus.net] has quit [Client exited]
21:09 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has quit [Connection closed]
21:27 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [Ping timeout: 121 seconds]
21:28 Stalker is now known as Allison
21:28 Prophet is now known as Attilla
21:29 Serah is now known as Nick
21:29 Swillin` is now known as AnnoDomini
21:30 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
21:33 Nick [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
23:08 Orthia [orthianz@Nightstar-61dbfba9.xnet.co.nz] has joined #code
23:34 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
23:38 shade_of_cpux is now known as cpux
23:44
< AnnoDomini>
Is it fine to just make a includes.h file where I paste everything I need anywhere and include that everywhere?
23:44
<@McMartin>
It's legal but dispreferred.
23:45
<@McMartin>
Because if you have to change it, suddenly you have to recompile absolutely everything.
23:45
< AnnoDomini>
That's only a problem is recompiling everything takes long.
23:45
< AnnoDomini>
Right?
23:46
<@McMartin>
Sure, but as a rule it's a pointless cost to pay.
23:46
<@McMartin>
It's like writing your whole program in one source file.
23:46
<@McMartin>
Caveat on this is that there exists a technology called "precompiled headers" where you basically do exactly this, but it has nasty side effects where setting it up wrong or failing to update it appropriately can result in illegal code being generated.
23:49
< AnnoDomini>
Uhuh.
23:50
< Alek>
hrm.
23:50
<@McMartin>
Actually
23:50
<@McMartin>
Don't call it "includes.h"
23:50
< Alek>
I've wondered about this myself.
23:50
<@McMartin>
Presumably you've got five or six top-level Big Components.
23:51
<@McMartin>
Do this individually for each Big Component and have it be "bigcomponent1.h", "bigcomponent2.h" and so on
23:51
<@McMartin>
Then each of those includes everything that component needs.
23:51
<@McMartin>
(For instance, the game logic has no reason to have the includse for the curses layer.)
23:51
< AnnoDomini>
Uhuh.
23:51
<@McMartin>
(That would make turning into a gui/tile game later way easier)
23:51
<@McMartin>
At *that* level of chunking you're approaching best practices.
23:52
< Alek>
if you put in an include file that includes all the existing includes you ever include *cough*, and then compile a program that uses only some of those includes, does the final code have all of the includes or only the parts you use?
23:52
<@McMartin>
If there's stuff in the includes that actually defines stuff, it has all of them.
23:52
< Alek>
also, I agree about the chunking mcm just mentioned. rather close to OO/modularity, and good for the same reasons, imho.
23:52
<@McMartin>
Includes *usually* don't define stuff, but with templates, sometimes they do.
23:53
< AnnoDomini>
Now I remember why I stopped coding in C++ a while back. It was because I spent 90% of the time trying to solve problems like these rather than do anything productive.
23:53
<@McMartin>
There's also an additional risk of name collision if there's stuff you don't use.
23:53
<@McMartin>
Yeah, pretty much. C++ is not for casual development - it's hard to improvise designs.
23:55
<@McMartin>
Alek: I think a key bit is that if you link in every library you'd ever use, you'll have a lot of cruft on most systems.
23:55
< Alek>
with a modular includes section (IO, display, file IO, etc) and modular code, it should be fairly easy to code from the ground up and then port to whatever it needs to be ported to, imho.
23:56
<@McMartin>
Yeah, though for his project the initial division is just display-and-input/game-logic, I think.
23:56
< Alek>
while making the basic movement, you use an ASCII display. then switch it out for tiles once you've got the basics down and want to work on the looks. etc. :P
23:57
<@McMartin>
IIRC, curses frontend is his ultimate goal here.
23:57
< Alek>
then transition to isometric and work on your z axis, then move to a 3d engine. <_<
23:57
<@McMartin>
So it's dumb terminal and line input at first, and then upgrading to curses, most likely.
23:57 * Alek coughs.
23:57
<@McMartin>
Unless it's basic animation first, but w/e
23:57
< AnnoDomini>
I need a better programming language. Suggestions?
23:57
<@McMartin>
You've already given up on PyCurses, IIRC.
23:57
<@McMartin>
Do I in fact RC?
23:58
< AnnoDomini>
RC?
23:58
< AnnoDomini>
Oh.
23:58
< AnnoDomini>
I never tried it. I forget if I had any reasonable objection.
23:58
<@McMartin>
Python has curses bindings.
23:58
< Alek>
what was that TLA language that could put a whole page of code on one line? using nonstandard symbols, too?
23:59
<@McMartin>
APL.
23:59
< Alek>
righto.
23:59
< Alek>
use that.
23:59
<@McMartin>
You may want to look at python - it's a very powerful, high-level scripting language with local experts here.
23:59
< AnnoDomini>
Right.
23:59
<@McMartin>
APL you should not use, if only because you don't have a keyboard that can type all the symbols.
23:59
< Alek>
:P
--- Log closed Wed Dec 01 00:00:06 2010
code logs -> 2010 -> Tue, 30 Nov 2010< code.20101129.log - code.20101201.log >