Re: [DM-dev] reward: what the Hell is wrong with this code?
Brought to you by:
acdalton,
henningsen
From: Stephan B. <ste...@ei...> - 2001-05-24 10:02:33
|
On Thursday 24 May 2001 00:47, you wrote: > Ok I did, and it did compile alright. But the thing in main_hierarchy > baffles me as much as you. I simplified the line in question, and the > same mistake occurs, if you just declare in the first line of the =2E.. > mistake. Forgot to do that while I was still in Linux, but then you'd > not want your code to have that structure, right? Some Makefile where > Room is last or treated in some special way that might result in > this? Damn. I was hoping a second pair of eyes would see something stupid I'd=20 forgotten. I first thought it was a problem with my: #ifndef FOO_H #define.... thought perhaps I had a duplicate of DOOR_H. That wasn't the case,=20 though. I renamed all of those to DM_CLASSNAME_H because I thought=20 perhaps "DOOR_H" may be defined in some other system header (couldn't=20 imagine why, though). Didn't fix it. I'm completely baffled. I'll keep=20 looking, though. I don't particularly want a structure with all headers in one common .h=20 file, mainly because it requires a rebuild on all cpp files for minor=20 changes to one header. While I've programmed as a hobby since I was a=20 kid, I didn't learn OO concepts, nor do anything "big" (more than a few=20 thousand lines) until I learned Java (started 5 years ago). Java has=20 very strict rules about classes and their files: * 1 public class per file * That class must have the same name as the file which contains the=20 sources (in c++, this is translated to mean one .h and one .cpp per=20 class). There are other rules regarding packages (namespaces) and the directory=20 structure to hold the files, but they don't apply at all to a c++=20 environment, so I won't go into them. The most common Java conventions dictate that classes are named like=20 ClassName, not classname, nor class_name nor Class_Name, and that=20 functions are named like functionName(), not function_name(), nor=20 FunctionName(). Of course, these are just conventions, but I stick to=20 them for consistency's sake, and because I find them quite readable.=20 It's easy to see I "come from Java" when one looks at my c++ code=20 (assuming one knows Java). I've found that to be soooo much simpler to maneauver through than=20 c-style code, so I try to stick with it in c++ as well (though I=20 occasionally step out of that). Anyway... back to work. It's a holiday (dunno which one), but today is=20 perfect for me to work. I get distracted very easily when people keep=20 coming to me with requests and questions and such, and get frazzled=20 because I forget what I was in the middle of. Quiet days like this one=20 are great. I just wish the weather wasn't so nice so I wouldn't feel so=20 guilty about being inside ;). See ya! ----- Stephan Beal Generic Universal Computer Guy ste...@ei... - http://www.einsurance.de Office: +49 (89) 552 92 862 Handy: +49 (179) 211 97 67 "Feel the fever coming. You're shaking and twitching. You can scratch all over but that won't stop you itching. Can you feel a little love?" -- Depeche Mode |