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

I am a C Programmer

Name: Anonymous 2012-01-27 23:08

Yes. I'm a C programmer. So? I don't see a problem. I embraced my UNIX soul long ago and I am happy together with my compiler (who is a cute layered front/backend design!). We have a fucking lot of functions in and outside of the kernel and I am pretty compact and resource conserving.

But thanks anyway asshole. Go and beat off to your stupid garbage collection shit while I #INCLUDE <stdio.h> with my preprocessor.

Name: Anonymous 2012-01-28 0:10

I suppose it's possible if i have something like


#define { { scope_open();
#define } scope_close(); }
#define new(x,y) y=##x __new(); scope_reg(y, ##y __free());
#define SCOPE_MAX_DEPTH 256

static int scope_idx = 1;
static std::map<void*, void(*pFree)()>[SCOPE_MAX_DEPTH] scope_elems;

void scope_open() {
  scope_idx++;
}
void scope_reg(pObj, pFree) {
  scope_elems[scope_idx].insert(pObj, pFree);
}
void scope_close() {
  for(int i = 0, e = scope_elems[scope_idx].size(); i < e; i++) {
    scope_elems[scope_idx][i].second(); /* destructor */
  }
  scope_elems[scope_idx].clear();
}


Obviously i would need to use a C equivalent of the std::map, which is trivial, and should use a dynamically expanding array instead of a fixed-size one..
.. but maybe it's possible after all...
Someone familiar with THE STANDARD tell me if those #defines are remotely close to being valid?

Name: Anonymous 2012-01-28 0:15

>>15
some addendums;
#define's must be after declaration of scope_ functions, or in another translation unit, to avoid an infinite loop when they are first called
#define new should call scope_reg with a function ptr, not the value

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