c++

Can't modify value returned by time.time() in Python code embedded in C++

Hi, I'm facing a very strange problem. The following code: import time target_time = time.time() + 30.0 doesn't work in Python code called from C++ (embedding)! target_time has the same value as time.time() and any attempt to modify it leaves the value unchanged in a pdb console... It happens after I've called root.initialise() ...

G++ 4.4 compile error, lower versions works

Hello, I have my program written in C++ and it is can be successfully compiled on Ubuntu 9.04 with g++ 4.3.4 and Solaris OS with g++ 3.4.3. Now I have upgraded my Ubuntu to version 9.10 and g++ to version 4.4.1. Now compiler invokes the error in STL. /usr/include/c++/4.4/bits/stl_deque.h: In member function ‘void std::deque<_Tp, _Alloc...

Why and when is cast to char volatile& needed?

In boost::detail::addressof_impl::f() a series of reinterpret_casts is done to obtain the actual address of the object in case class T has overloaded operator&(): template<class T> struct addressof_impl { static inline T* f( T& v, long ) { return reinterpret_cast<T*>( &const_cast<char&>(reinterpret_cast<const...

How to know if the Kerberos ticket has expired

Hi, I have a client side application that uses Kerberos authentication to connect to remote service. When reseting the password for the SPN in ADSI without renewing the ticket, the authentication fails (of course). The question is, if there is a way to know in advance that the ticket is not valid\ expired. Thanks!! ...

Is there any real point compiling a Windows application as 64-bit?

I'd confidently say 99% of applications we write don't need to address more than 2Gb of memory. Of course, there's a lot of obvious benefit to the OS running 64-bit to address more RAM, but is there any particular reason a typical application would be compiled 64bit? ...

Return a float array in C++

Hi, I currently have a 4x4 matrix class in C++ and I store each value as a float: Matrix4d::Matrix4d(const float& m00, const float& m01, const float& m02, const float& m03, const float& m10, const float& m11, const float& m12, const float& m13, const float& m20, const float& m21, const float& m22, ...

Read write mutex in C++

This is an interview question. How do you implement a read/write mutex? There will be multiple threads reading and writing to a resource. I'm not sure how to go about it. If there's any information needed, please let me know. Update: I'm not sure if my statement above is valid/understandable. But what I really want to know is how do you...

Is it possible to implment a COM interface without creating a custom interface?

I am learning c++ and I am trying to better understand it. I was reading the msdn documents on how to use xml lite. it said that I must use a class that implements the IStream interface. It said to declare and instantiate my class that extends Istream and use CComPtr when declaring the varible. then it showed me the following. CComPtr<I...

-fomit-frame-pointer, is it safe to use it?

I've seen in many places that people often use the option -fomit-frame-pointer when compiling C / C++ code and I wonder, is the use of that option safe? What is it used for? Thank you very much, best regards. ...

Question about exact time of destruction of temporaries in C++

Hi, is the following code safe (it works in DEBUG) : void takesPointer(const Type* v);//this function does read from v, it doesn't alter v in any way Type getValue(); ... takesPointer(&getValue());//gives warning while compiling "not an lvalue" ... Type tmp = getValue(); takesPointer(&tmp);//this is safe, and maybe I should just do it, ...

Threading books for C++

What are the best C++ threading books one should read? And also, please indicate which threading library it uses and its level like beginner, intermediate, advanced or reference. ...

QWidget's paintEvent() lagging application

i'm studying and modifying the fridge magnets example, and the last thing I've tried to do was to draw a few labels and lines that are supposed to be on the background. After looking around trying to figure out how to draw the labels and lines, I learned that I could override QWidget's paintEvent() to do it. After I did it though, the a...

C++: what benefits do string streams offer?

could any one tell me about some practical examples on using string streams in c++, i.e. inputing and outputing to a string stream using stream insertion and stream extraction operators? ...

win32 application aren't so object oriented and why there are so many pointers?

This might be a dumb question to some of you and maybe I asked this question wrong, because I am new to c++. But I notice when working in a lot of win32 applications, you use a lot of resources that are pointers. Why do you have to always acquire a objects pointer ? why not initiate a new instance of the class. and speaking of that, I no...

How to enumerate system restore points using WinAPI (not WMI)?

Must work for WinXp - Vista - Windows 7 ...

Why doesn't my overloaded comma operator get called?

Hi, I'm trying to overload the comma operator with a non-friend non-member function like this: #include <iostream> using std::cout; using std::endl; class comma_op { int val; public: void operator,(const float &rhs) { cout << this->val << ", " << rhs << endl; } }; void operator,(const float &lhs, const comma_o...

visual C++ express 2010 and setting env variables solution wide

Hello, I'm C++ dev migrating to visual 2010 c++ from vim/g++. Here blog I've read that VC++ directories are no more and that I should use property pages in vs 2010 but I don't know how... Here is what I need to do. I have w solution (50 projects strong) and all of them use boost, pthreads, xercesc and few other libs. I have env variables...

Resource Contention

While profiling my app using Pix, I noticed that the GPU is passing (in DX10 mode) most of its time in idle waiting for a resource not available. (and is always in row with the CPU (for example if the CPU is processing frame X, the GPU is also processing frame X) for this problem) Some note : 1) The app is GPU limited (the CPU is basic...

How do I get Doxygen to "link" to enum defintions?

I have the following code: /// \file Doxygen_tests.h /** * * \enum Tick_Column_Type * * \brief Values that represent Tick_Column_Type. **/ enum Tick_Column_Type { TC_OPEN, ///< Opening price TC_HIGH, ///< High price TC_MAX, ///< Required as last enum marker. }; /** * * \struct Tick...

Problem with iostream, my output endl are littles squares.

I have a problem with with my output when I write to I file I get squares when I put endl to change lines. std::ofstream outfile (a_szFilename, std::ofstream::binary); outfile<<"["<<TEST<<"]"<<std::endl; I get something like this in my file plus the other outputs don't write on the next line but on the same one. [TEST]square appa...