[Libbt-devel] Intro and... suggestions
Brought to you by:
ksmathers
From: Pandora <pub...@pa...> - 2005-04-20 05:16:41
|
Good morning all, Pandora here, aka synx13 on sourceforge. I like the notion of a bittorrent library, since I'm planning an app that uses both bittorrent, and other stuff (some sort of feed protocol). Since I'd therefore be making a bittorrent library anyway, I was hoping to help you folks out with whatever my twisted little mind could cook up. Okay, intros aside. I had some difficulty with the CVS of the code. To be honest it's gotten quite... messy. I'd like to discuss some standards here. As I fix the code there are a few things I'm not certain on; things that could go either way. I have recommendations, but before acting on those recommendations I'd like to ask other people here what they'd want. 1) Object naming Many places (but not all; messy!) I see classes named this way: | struct btClass; | typedef struct btClass btClass; As elegant as that is, my syntax highlighter likes to see _t at the end of typenames. It's got a point too: everywhere in C you have to identify what a type is (struct, union, enum, etc) right by the type name, except typedefs. So adding a _t makes it easier to identify something as a type, and also leaves the class's formal name open for the name of a variable. Also, there's a trick we could use so we can even pretend we're not using pointers, which results in much less * writing, and really seems to work out elegantly when I've done it. So I propose we do this: | typedef struct btClass *btClass_t; instead of this: | struct btClass; | typedef struct btClass btClass; When we want to get at the implementation of btClass, we can use 'struct btClass' but otherwise we can toss around btClass_t things like they were opaque candy. | btClass *someFunction(btClass *, btClass **); //The old interface | btClass_t someFunction(btClass_t, btClass_t*); //The new interface So... what about that? Obey my syntax highlighter and use _t? Typedefs to all opaque structures as pointers, not just aliases? I'm going forward with this system unless anybody brings forth any issues. Okay? |