Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C naming convention

Name: Anonymous 2010-04-09 3:53

I'm trying to decide on a naming convention for my C library. Do I do pthreads/libpng/etc style, using capital letters only for constants and macros?

typedef struct foo {
  int* bar;
} foo_t;

void foo_init(foo_t* self) {
  self->bar = (int*) malloc(sizeof(int) * 5);
}

void foo_destroy(foo_t* self) {
  free(self->bar);
}


Do I do CamelCase?

typedef struct Foo {
  int* bar;
} Foo;

void FooInit(Foo* self) {
  self->bar = (int*) malloc(sizeof(int) * 5);
}

void FooDestroy(Foo* self) {
  free(self->bar);
}


Or do I do something even more crazy?

I'm definitely leaning towards pure lowercase. It's not really more work to write, and it's a lot easier to read afterwards. Plus it's really consistent with the standard library, among others.

What convention do /prog/lodites use?

Name: Anonymous 2010-04-09 4:39

I prefer CamelCase for variables and the first style(i forgot what it was called) for functions.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List