Memory leaks #4260 (7/1/2009 10:40:35 PM) comp.lang.c++ I just looked at some code which unfortunately I no longer have access to. To the best of my memory it was something like this: void SomeFunc(Base*,int); int main() { base Base; otherbase Base; ... CplusplusNewbie
C++ Primer 4th edition Reference Counting Smart Pointers2815 (6/28/2009 2:52:14 PM) comp.lang.c++ In Scott Meyers' Effective STL, he stresses that it's incredibly difficult to write smart-pointer code, and that his attempts in one of his own texts had several bugs etc. This confuses me somewhat because Lip... CplusplusNewbie
Deleting a pointer1529 (6/26/2009 11:56:43 AM) comp.lang.c++ I wonder why the authors of C++ didn't write the delete function so that, for example, the code delete p; stands for delete p; p = 0; That way, there would be no problem if pointers were deleted twice.... CplusplusNewbie
Template generation of Fibonacci numbers.533 (6/26/2009 11:26:23 AM) comp.lang.c++ I'm concerned about this code for generating Fibonacci numbers which is pasted from a website. As I understand it, this is not really a template design at all because only one type is used -- integers -- wherea... CplusplusNewbie
Web resources on multithreading118 (6/26/2009 10:44:36 AM) comp.lang.c++ I have downloaded Boost and I have also downloaded a release of the Posix threads. I'm trying to learn multithreading in c++ using web resources and web tutorials. I'd be interested to hear recommendations. T... CplusplusNewbie
const_cast #4420 (5/3/2009 7:36:32 PM) comp.lang.c++ I've been told that const_cast "adds or removes the constness of an expression". I understand that it converts pointers to const to pointers to non- const and references to const to references to non-const. Bu... Comp1597
extern variables823 (5/1/2009 10:23:01 AM) comp.lang.c++ I know this is a standard topic and I've done a fair amount of googling but I'm still a bit confused by extern variables. My main text is C++ Primer, 4th edition (Lippman, Lajoie and Moo). For example, I ran ... Comp1597
standard namespace2319 (4/19/2009 5:07:19 PM) comp.lang.c++ I have included cmath and I find that I can call the square root function by either std::sqrt or sqrt For example, I can calculate std::sqrt(3.0); or sqrt(3.0); However, std::cout from insists on the std ... Comp1597
Improving efficiency of algorithm1123 (4/12/2009 2:47:50 PM) comp.lang.c++ I have a function with signature: unsigned f(unsigned); My task is to read positive integers from a file (call each number x) and to write f(x) on standard output My code goes like this: BEGINNING OF CODE ... Comp1597
possible typo in multithreading website920 (4/12/2009 11:28:47 AM) comp.lang.c++ I have read the above from a multithreading in c++ tutorial: BEGINNING OF QUOTE Now imagine that we start a number of threads, all executing workerThread(). If we have just one thread, doSomeWork() is going t... Comp1597
Comp1597's replies:
Items(9) /1
Memory leaks #4260 (7/1/2009 10:40:35 PM) comp.lang.c++ I just looked at some code which unfortunately I no longer have access to. To the best of my memory it was something like this: void SomeFunc(Base*,int); int main() { base Base; otherbase Base; ... Comp1597(41)
C++ Primer 4th edition Reference Counting Smart Pointers2815 (6/28/2009 2:52:14 PM) comp.lang.c++ In Scott Meyers' Effective STL, he stresses that it's incredibly difficult to write smart-pointer code, and that his attempts in one of his own texts had several bugs etc. This confuses me somewhat because Lip... Comp1597(41)
const_cast #4420 (5/3/2009 7:36:32 PM) comp.lang.c++ I've been told that const_cast "adds or removes the constness of an expression". I understand that it converts pointers to const to pointers to non- const and references to const to references to non-const. Bu... Comp1597(41)
extern variables823 (5/1/2009 10:23:01 AM) comp.lang.c++ I know this is a standard topic and I've done a fair amount of googling but I'm still a bit confused by extern variables. My main text is C++ Primer, 4th edition (Lippman, Lajoie and Moo). For example, I ran ... Comp1597(41)
Improving efficiency of algorithm1123 (4/12/2009 2:47:50 PM) comp.lang.c++ I have a function with signature: unsigned f(unsigned); My task is to read positive integers from a file (call each number x) and to write f(x) on standard output My code goes like this: BEGINNING OF CODE ... Comp1597(41)
possible typo in multithreading website920 (4/12/2009 11:28:47 AM) comp.lang.c++ I have read the above from a multithreading in c++ tutorial: BEGINNING OF QUOTE Now imagine that we start a number of threads, all executing workerThread(). If we have just one thread, doSomeWork() is going t... Comp1597(41)
legal use of const?1013 (4/9/2009 10:10:01 PM) comp.lang.c++ Is the following code legal? void f(const int ing) { ing++; } int main() { } I would have thought not, and my compiler agrees. It's an error because a const is being modified. However, on another thread s... Comp1597(41)
commenting errors flagged as warnings instead of errors121 (4/8/2009 8:26:58 PM) comp.lang.c++ I'm using Visual C++ on Windows Vista. Being "only human", I sometimes use ***************************************/ to underline a section of code instead of the correct /************************************... Comp1597(41)
sorting problem2224 (4/1/2009 11:10:51 PM) comp.lang.c++ Suppose we have pairs of integers of the form (a,b). I want to define (a,b) =c and b<=d (The motivation for this definition is that it means that the interval (a,b) is a subset of (c,d) ). Are there any STL f... Comp1597(41)