July 28th, 2005


(no subject)

God damn you, C++. Why must you thwart me so? C would never stop me doing what I want. If C had constructors, and I said to it "hey, give me a pointer to that constructor function", it would say "certainly sir, would you like fries with that?"

C++ just swears at me in Spanish until I go away. If I tell it to take off every zig, if I say "I know what I doing, C++, take off every zig", it responds "ha ha ha ha ha" and then tells me to make my time.

Sure, it'll let me call a constructor if my code knows the class name, but what use is that for run-time loading and linking to things? Sod all use, is the answer. And it's not like it makes it easy even to do that, with its stupid bloody 'keywords' instead of good clean function-style syntax for 'new' and 'delete'. Way to fuck up macros, C++. I hate you. The only good thing you ever did was to make the 'class' keyword, and the only reason that's good is because it's a slight improvement on the syntax of struct. That and making it so local variables can be declared any time before they're used rather than having to be declared at the start. Apart from that, you are tantamount to Java.

You are on the way to destructors.

(no subject)

Yes! Thank you Google. Not quite a pointer to the constructor that I bloody should be able to get (the resultant assembly code calls it directly like any other function, so why can't I?), but good enough.
class STUPID {
  static void *ConstructoryEnough(void *pos) {return new(pos) STUPID;}
typedef void* (*CONSTRUCTORPOINTER)(void*);
void *ConstructMeOneOfThese(CONSTRUCTORPOINTER p,void *space) {
int main() {
  char buffer[sizeof(STUPID)];
  void *(*pconstructor)(void*)=STUPID::ConstructoryEnough;
  ConstructMeOneOfThese(pconstructor,buffer); //constructor is called using only a pointer and an allocated space, yay
  ((STUPID*)buffer)->~STUPID(); //destructor called directly, but could be pointerised the same way
Hidden behind that block of code is a really great story about some funny things that happened to me when I went to the shops the other day, and also some pictures of really great things I saw - amusing and pornographic things. See what C++ does? You've all missed out on that fantastic material, and it's all because of C++ engaging in coverups.