[prev] [thread] [next] [lurker] [Date index for 2004/03/02]
In someways it's nice but it's just all the little shit bits that are really pissing me off today. I admit that most are because I've been spiled with my wonderful experiences with the incomparable joy that is Perl but here I shall detail some of the more heinous hates. public: string error(); private: string error; one is a method, one is a member. Why won't you let me have both. Similarly I want, ala my Perl experiences the classes Reelmaker Reelmaker::Generator (used as a helper class by Reelmaker) Reelmaker::Generator::Quicktime (a sub class of R:G) i.e I want three classes and two namespaces - Reelmaker and Reelmaker::Generator. BZZZZZT! No can do - can't have a class and a namespace named the same thing. I'll admt that, in general, strings (as done via std::string) is much nicer than the char * shennanigans that I'm used to from C but, when I wnat to find the file extension of something in C I do tmp = strrchr(filename, '.'); if(tmp) { printf("file extension of %s is %s\n, filename, ++tmp); } in C++ string::size_type pos = filename.rfind("."); if (pos == string::npos) { string ext = filename.substr(pos+1,filename.size()-pos); cerr << "File extension of << filename << " is " << ext << endl; } which feels far more cumbersome. Sticking with strings - why isn't there a format method, why, if I have a format and a number and I want them to end up in a string do I have to do something like // format is something like 'filename%d.jpg' char * output = (char *) malloc(sizeof(char) * 1024); if (!output) { cerr << "Couldn't alloc filename" << endl; return 0; } // we use the filename like a format int ret = snprintf(output, 1024, format.c_str(), frame++); if (ret <0 ) { cerr << "Couldn't format filename : " << format << endl; return 0; } string filename = output; free(output); return filename and even fucking worse why if I can do something like cerr << "The input " << input << "is invalid" << endl; if num is a string, int or floats but, if I want to do something like error = "The input " + input + "is invalid"; it'll only work for strings. For itns I have to jump through these hoops error = "The input " + string(""+input) + "is invalid"; and I have to do snprintf hoops for floats. Sigh. I believe the phrase I'm stretching for is "ha' penny worth o' tar" Simon
Generated at 14:02 on 01 Jul 2004 by mariachi 0.52