The title is a bit of a misnomer, what I mean really is "C with classes".
Let me explain, recently I bought the book ShaderX7 which came with a lite (and old) copy of the Unigine engine for one of the articles about shadow mapping techniques.
I was dabbling through the code when I realized that, while the author was using C++ and inheritance and all the C++ goodness, most if not all the method content was essentially C-style code; for example:
int Shader::get_param(const char *name,char *src,String &dest) const {
char *s = src;
int size = (int)strlen(name);
while(*s) {
if(!strncmp(s,name,size)) {
if((s == src || strchr("\n\r",*(s - 1))) && strchr(" \t",*(s + size))) {
src = s;
s += size;
dest.clear();
while(*s && strchr(" \t",*s)) s++;
while(*s && strchr(" \t\n\r",*s) == NULL) dest += *s++;
if(dest.isEmpty()) {
Log::error("Shader::get_param(): can't get \"%s\" \n",name);
return 0;
}
memmove(src,s,strlen(s) + 1);
return 1;
}
}
s++;
}
return 0;
}
I am not saying this is bad, it does the job and that's what matters but I'm more used to C++ style constructs, with std::string, vectors etc... and I make big use of the Boost libraries; so this kind of style come as a bit of a surprise to me.
Is it really better/faster to use this kind of code than to go the generic, OO way ?
Did I fall into the "too much abstraction" trap ?
Edit: corrected method name to make it clear what it is doing.