From: Simon Wistow Date: 15:29 on 13 Nov 2003 Subject: C++ Actually it might just be gcc or g++ or C in general or maybe just my set up but I hate something. Possibly this is a PEBCAK situation, maybe I just expect stuff to work more like interpreted languages but ... So I'm writing a threaded C++/QT app. And it's all working fine. And I go to change something - no new functionality at the moment just putting in various variables that I'm going to need and initialising them in the constructor. And the app segfaults. So I start commenting out lines starting. And everytime it compiles fine but segfaults on start. Eventually I've copied out every line that I've put in. And it's still segfaulting. GDB claims that it's in a part of the program that I've never touched. I try deleting all the files which I've updated and checking them out of CVS again. Still segfaults. Scratch head. % make clean; make Go away to get coffee. Wait 5-10 minutes. Come back. Works fine. Grr. And it keeps happening. And make-ing clean appears to be the only way to make sure it works. Sigh. Hate.
From: Simon Wistow Date: 15:29 on 02 Mar 2004 Subject: C++ 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
From: peter (Peter da Silva) Date: 17:06 on 02 Mar 2004 Subject: Re: C++ > In someways it's nice Even for a pervy Perl-lover that's scary. C++ and "nice" don't belong in the same conceptual framework unless there's a negation and a lot of juicy expletives involved.
From: Simon Wistow Date: 17:08 on 02 Mar 2004 Subject: Re: C++ On Tue, Mar 02, 2004 at 11:06:03AM -0600, Peter da Silva said: > Even for a pervy Perl-lover that's scary. C++ and "nice" don't belong > in the same conceptual framework unless there's a negation and a lot > of juicy expletives involved. Not having to do the malloc dance is nice. malloc is hateful. As are header files. It's like people went "I know - what are computers good at - keeping track of things. So let's make the human do it instead". I know, I know I shpuld just use the Lea allocator or some equivalent.
From: peter (Peter da Silva) Date: 17:14 on 02 Mar 2004 Subject: Re: C++ > > Even for a pervy Perl-lover that's scary. C++ and "nice" don't belong > > in the same conceptual framework unless there's a negation and a lot > > of juicy expletives involved. > Not having to do the malloc dance is nice. If you're having to do a lot of memory tracking then you probably want to get away from the C language family completely. Out of that whole family, only C and Javascript have any elvis-nature. > malloc is hateful. As are header files. It's like people went "I know - > what are computers good at - keeping track of things. So let's make the > human do it instead". For the kinds of things I use C for, I'm much better at tracking memory allocation than the computer is.
From: Simon Wistow Date: 17:21 on 02 Mar 2004 Subject: Re: C++ On Tue, Mar 02, 2004 at 11:14:30AM -0600, Peter da Silva said: > If you're having to do a lot of memory tracking then you probably want to > get away from the C language family completely. Out of that whole family, > only C and Javascript have any elvis-nature. Trust me, I ahte them all. But for some occasions they're needed. This is one of those times. I hate these times. > For the kinds of things I use C for, I'm much better at tracking memory > allocation than the computer is. I was under the impression that the Lea allocator was now practically indistinguishable from humans for ~90% of occasions. Although I accept that you may be in that other ~10% e in that other ~10%
From: peter (Peter da Silva) Date: 17:30 on 02 Mar 2004 Subject: Re: C++ > I was under the impression that the Lea allocator was now practically > indistinguishable from humans for ~90% of occasions. Although I accept > that you may be in that other ~10% No, I'm partly cloudy with a 30% chance of rain.
From: Yoz Grahame Date: 17:24 on 02 Mar 2004 Subject: Re: C++ Peter da Silva wrote: > If you're having to do a lot of memory tracking then you probably want to > get away from the C language family completely. Out of that whole family, > only C and Javascript have any elvis-nature. Javascript is C language family? Maybe, but only if Java and Python are too, surely? I think Javascript's a completely lovely language. It's only when you start having to control web pages with it that things turn nasty. -- Yoz
From: peter (Peter da Silva) Date: 17:34 on 02 Mar 2004 Subject: Re: C++ > Javascript is C language family? Maybe, but only if Java and Python are > too, surely? Java is, but it has no elvis-nature. http://scarydevil.com/~peter/io/java.html (actually about EJB but Java's not a whole lot less screwed up without EJB) Python... um, if Python's in the C family then so is FORTRAN and RPG. > I think Javascript's a completely lovely language. It's only when you > start having to control web pages with it that things turn nasty. Is there a good command-line JS interpreter out there?
From: Yoz Grahame Date: 17:49 on 02 Mar 2004 Subject: Re: C++ Peter da Silva wrote: >>Javascript is C language family? Maybe, but only if Java and Python are >>too, surely? > > Python... um, if Python's in the C family then so is FORTRAN and RPG. That may be, but Javascript's closer to Python than it is to Java, the name and braces notwithstanding. >>I think Javascript's a completely lovely language. It's only when you >>start having to control web pages with it that things turn nasty. > > > Is there a good command-line JS interpreter out there? http://www.mozilla.org/js/spidermonkey/ ... is the standalone/embeddable C implementation of Javascript used in Mozilla, which can be run as a shell. There are a whole ton of other ECMAscript implementations out there too, in many languages, including Mozilla's Rhino project which is pure Java. Annoyingly there are two seperate modules tying Spidermonkey to Perl, but neither's been taken far enough to be really useful. -- Yoz
From: peter (Peter da Silva) Date: 18:05 on 02 Mar 2004 Subject: Re: C++ > > Python... um, if Python's in the C family then so is FORTRAN and RPG. > That may be, but Javascript's closer to Python than it is to Java, the > name and braces notwithstanding. In the sense that Javascript is closer to Python than it is to Java, any sane object-oriented language is closer to Python than it is to Java. That's like saying a swallow is in the same family as a bat because they can both fly, and pointing to the emu as proof the swallow isn't a bird. :) > > Is there a good command-line JS interpreter out there? > http://www.mozilla.org/js/spidermonkey/ Can that be built without having to set up the whole Mozilla tree around it yet? I started poking at it once and panicked. > Annoyingly there are two seperate modules tying Spidermonkey to Perl, > but neither's been taken far enough to be really useful. Um. Hell with useful, I can't figure out how it would be meaningful.
From: Arthur Bergman Date: 11:19 on 03 Mar 2004 Subject: Re: C++ On 2 Mar 2004, at 18:05, Peter da Silva wrote: > >> Annoyingly there are two seperate modules tying Spidermonkey to Perl, >> but neither's been taken far enough to be really useful. > > Um. > > Hell with useful, I can't figure out how it would be meaningful. What! You mean you never had the desire to embed perl into a C application so you can script it in perl, and then embed javascript inside perl so you can script the perl part of the c application! Apparently your evil neurons need more stimulants. Arthur
From: Philip Newton Date: 17:42 on 02 Mar 2004 Subject: Re: C++ On 2 Mar 2004 at 15:29, Simon Wistow wrote: > 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. Consider public: int error(); private: void* error; and later void *foo = object.error; are you assigning the address of the method to "foo", or the value of the member? > // we use the filename like a format > int ret = snprintf(output, 1024, format.c_str(), frame++); My pet hate with the STL was needing to call .c_str() all over the place when working with legacy APIs; the application we were converting to STL had previously used MFC, whose CString class has an "operator const char *" which just did the right thing, as long as you had a prototype in scope. Cheers, Philip
Generated at 10:27 on 16 Apr 2008 by mariachi