First  |  Prev |  Next  |  Last
Pages: 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
"Scoping" variables the middle of their "natural" scope - RAII - is it a good practice?
Hello everybody, Let me explain what I mean, In my job I find many times the next "pattern" void foo() { //some code { //"re-scoping" char sTmp[256] = ""; //some code } //some code } sometimes the "re-scoping" was made to keep sTmp in his reservation and ... 16 Jan 2010 15:00
warning: taking address of temporary, what's the problem?
I am getting this warning from g++ 4.4.2 and yes indeed it is taking the address of a temporary, but the temporary ought to still be alive when it matters AFAIC. So can someone tell why what, if anything, I am doing wrong. Here is my example: #include <iostream> #include <string> class Temporary { public: ... 18 Jan 2010 10:50
ANNOUNCE: just::thread library V1.3 released
Hi, I am pleased to announce that version 1.3 of just::thread, our C++0x Thread Library has just been released. With just::thread you can use the multithreading facilities from the new C++0x standard with your existing compiler. This release is the first to feature support for the new std::async function for ... 14 Jan 2010 14:38
Reinterpret cast and CRTP
When i use the curiously recurring template pattern, do i need to use the reinterpret_cast to get the derived class or do i use the static_cast? And is there a performance penalty in doing this cast? For example template<class Derived> class Base { public: void foo() { reinterpret_cast<Derived*>(this)->ba... 18 Jan 2010 10:50
reasoning of ::std::cout (ostream) conversion w.r.t. plain, signed and unsigned chars...
On 10 Jan, 01:21, Francis Glassborow <francis.glassbo...(a)btinternet.com> wrote: Nick Hounsome wrote: On Jan 8, 1:39 pm, leonleon77 <leonleo...(a)gmail.com> wrote: Firstly the type is "unsigned char" not "unsigned very short int" and char is short for character so I would expect a character to be out... 11 Jan 2010 17:36
Is union really useful in C++ considering that there is reinterpret_cast?
On Jan 1, 3:55 pm, Peng Yu <pengyu...(a)gmail.com> wrote: union is inherited from C. But since C++ has reinterpret_cast, I'm wondering when union would be useful in a pure C++ program. Or union is just for backward compatibility. Could somebody give some examples on when to use union and when to use reinte... 11 Jan 2010 17:36
reasoning of ::std::cout (ostream) conversion w.r.t. plain, signed and unsigned chars...
On Jan 9, 12:28 pm, Nick Hounsome <nick.houns...(a)googlemail.com> wrote: Firstly the type is "unsigned char" not "unsigned very short int" and char is short for character so I would expect a character to be output not an integer. Interesting. Given the above are we then to state the following: 1) g... 11 Jan 2010 15:21
Simple beginners program
I am teaching my self C++ and this program is very simple, but I do not understand why the cin.getline() command is not working. Thank you for your help! #include <iostream> #include <iomanip> using namespace std; int main() { const int SIZE=20; int age; char name[8], cityName[6], profession[1... 11 Jan 2010 17:36
reasoning of ::std::cout (ostream) conversion w.r.t. plain, signed and unsigned chars...
Nick Hounsome wrote: On Jan 8, 1:39 pm, leonleon77 <leonleo...(a)gmail.com> wrote: Firstly the type is "unsigned char" not "unsigned very short int" and char is short for character so I would expect a character to be output not an integer. An interesting assertion. However arithmetic operations on char... 9 Jan 2010 20:42
Is this exception-safe code template correct?
Hi! David Abrahams introduced the exception safety guarantees. http://www.boost.org/community/exception_safety.html In order to easier create exception safe code I have written a function code template (a mind template, *not* a C++ template) that I can give to colleagues, friends, you (if you want), and myse... 14 Jan 2010 14:38
First  |  Prev |  Next  |  Last
Pages: 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56