c++

C++ variable alias - what's that exactly, and why is it better to turn if off?

I've read the essay Surviving the Release Version. Under the "Aliasing bugs" clause it says: You can get tighter code if you tell the compiler that it can assume no aliasing.... I've also read Aliasing (computing). What exactly is a variable alias? I understand it means using a pointer to a variable is an alias, but, how/why ...

Is there a program that reorganizes .cc method definitions to be ordered according to .h declarations?

Is there a program that reorganizes .cc method definitions to be ordered according to .h declarations? ...

C++ fixed point library?

I am looking for a free C++ fixed point library (Mainly for use with embedded devices, not for arbitrary precision math). Basically, the requirements are: No unnecessary runtime overhead: whatever can be done at compile time, should be done at compile time. Ability to transparently switch code between fixed and floating point, with no ...

Attribute vector emptying itself

Hello, I have two classes, derived from a common class. The common class has a pure virtual function called execute(), which is implemented in both derived classes. In the inherited class I have an attribute which is a vector. In both execute() methods I overwrite this vector with a result. I access both classes from a vector of pointer...

Why does output of fltk-config truncate arguments to gcc?

I'm trying to build an application I've downloaded which uses the SCONS "make replacement" and the Fast Light Tool Kit Gui. The SConstruct code to detect the presence of fltk is: guienv = Environment(CPPFLAGS = '') guiconf = Configure(guienv) if not guiconf.CheckLibWithHeader('lo', 'lo/lo.h','c'): print 'Did not find liblo for OSC...

skipped when looking for precompiled header

So some reason, my .cpp file is missing it's header file. But I am not including the header file anywhere else. I just started so I checked all the files I made enginuity.h #ifndef _ENGINE_ #define _ENGINE_ class Enginuity { public: void InitWindow(); }; enginuity.cpp #include "Enginuity.h" void Enginuity::InitWindow() { }...

libvlc_media_player_get_time returning zero

Hi! hey people I was writing a simple application to run a video stream using libvlc.But it seem that libvlc_media_player_get_time() function is not working properly.It is returning zero every time it is being called no matter how much video has been played.So can you please find out the possible remedies for it. Also is there any signal...

Where can I find a good source code for benchmarking a certain compiler?

I want to determine which compiler is better on 2 different platforms. First, I want to know whether sunCC or GCC generates fastest code in a Solaris system. Then, I'd like to know whether aCC or GCC generates fastest code in a HP/UX system. Thanks. ...

Realtime processing and callbacks with Python and C++

I need to write code to do some realtime processing that is fairly computationally complex. I would like to create some Python classes to manage all my scripting, and leave the intensive parts of the algorithm coded in C++ so that they can run as fast as possible. I would like to instantiate the objects in Python, and have the C++ algor...

Memory leak while using emoticons on CRichEditCtrl

I'm developing a text editor class (for a chat application) based on CRichEditCtrl (MFC) with emoticon support. After i load the emoticon's bitmap, I use the function OleCreateStaticFromData to insert it into CRichEditCtrl. After that i just delete the bitmap object allocated by myself. I can verify (using a GDIView utility) that all r...

Inner angle between two lines

Hi folks, I have two lines: Line1 and Line2. Each line is defined by two points (P1L1(x1, y1), P2L1(x2, y2) and P1L1(x1, y1), P2L3(x2, y3)). I want to know the inner angle defined by these two lines. For do it I calculate the angle of each line with the abscissa: double theta1 = atan(m1) * (180.0 / PI); double theta2 = atan(m2) * (18...

what is a virtual adapter

I hear the term virtual adapter from time to time. But not exactly sure what it is. I can't exactly find a good definition online. Is there an exact definition for a virtual adapter. If so, what is it. Or what does it usually mean ? ...

missing subscript c++

right now c++ is giving me this error: error C2087 'color' missing subscript first time i get this and i dont know what to do >.< hope any1 can help me struct Color{ float r; float g; float b; }; Color color[][]; and im using it here for(int i=0;i<cubes;i++) { color[i][0].r = fRand();color[i][0].g=fRand(.5);color[i][...

What is an interface in C (COM) is it the same as a interface in C#

Ok, I know what a interface is, but since I got into C and working with COM objects (Component Object Model), it seems an interface in COM is a little different from the interface I know of. So what I am trying to do is bridge the gaps here cause since I been learning C, alot of things have been sounding very familiar to me but are not ...

using #define one time for multiple source files

is there a way in visual c++ to #define something in a cpp file and have it defined in other cpp files as well? ...

Code coverage (c++ code execution path)

Let's say I have this code: int function(bool b) { // execution path 1 int ret = 0; if(b) { // execution path 2 ret = 55; } else { // execution path 3 ret = 120; } return ret; } I need some sort of a mechanism to make sure that the code has gone in any possible path, ...

What is the correct way of using an auto_ptr on dynamically allocated arrays?

If i use auto_ptr to hold a pointer to a dynamically allocated array, when the auto_ptr gets killed it will use a plain delete operation and not delete[] thus not deleting my allocated array. How can i (properly) use auto_ptr on dynamically allocated arrays? If this is not possible, is there another smart pointer alternative for dynami...

Easiest way to sign/certify text file in C++?

I want to verify if the text log files created by my program being run at my customer's site have been tampered with. How do you suggest I go about doing this? I searched a bunch here and google but couldn't find my answer. Thanks! Edit: After reading all the suggestions so far here are my thoughts. I want to keep it simple, and since...

using strcpy_s for TCHAR pointer (Microsoft Specific)

I was wondering which is the correct way? _tcscpy(tchar_pointer, _tcslen(tchar_pointer), _T("Hello World")); or _tcscpy(tchar_pointer, _tcsclen(tchar_pointer), _T("Hello World")); or _tcscpy(tchar_pointer, ???, _T("Hello World")); ...

Need help with implementing collision detection using the Separating Axis Theorem

So, after hours of Googling and reading, I've found that the basic process of detecting a collision using SAT is: for each edge of poly A project A and B onto the normal for this edge if intervals do not overlap, return false end for for each edge of poly B project A and B onto the normal for this edge if intervals do n...