Hello,


I am looking for general advices/resources on how to write C code that closely resembles good object oriented style. I have just started to read book Object Orientated Programming in ANSI-C by Axel-Tobias Schreiner but after quickly skimming the book I have an impression that it is not well written. There are several reasons why I think so but here I decided to focus on just one, please take a look at the code snippet taken directly from the book:


Code:
void * new (const void * type, ...){
int * p; /* & heap[1..] */
for (p = heap + 1; p < heap + MANY; ++ p)
if (! * p)
break;
assert(p < heap + MANY);
* p = MANY;
return p;
}

This function takes an argument which is never used. Author doesn't use braces to organize the code, so as a result code is hard to read. Returns pointer to localy created variable o.0 I cannot believe what I see but as you can see it is true!


Could somebody say that this book is good/recommended? I would say no - it is badly written and teaches really bad practices.


And going back to the main subject which is OO in C - what would you recommend?