c++

C++ passing arguments to a program already running

I'm reading through a tutorial on using voice commands to control applications and, in an example of controlling rhythmbox, it suggests commands such as the following can be executed: rhythmbox-client --play rhythmbox-client --pause Why does this not simply open a new instance of the program, and how can I emulate the functionality in...

Vector.erase(Iterator) causes bad memory access

Hi, I am trying to do a Z-Index reordering of videoObjects stored in a vector. The plan is to identify the videoObject which is going to be put on the first position of the vector, erase it and then insert it at the first position. Unfortunately the erase() function always causes bad memory access. Here is my code: testApp.h: vector...

Disabling Scrollbars in WebKit (flat frame mode)

Hello, I'm embedding WebKit in a Windows C++ Application. I'm using the Cairo port. It works fine. I'd like to disable the scrollbars that appear when there's more data that the client area can display. Like the iPhone, the iPhone does not have scrollbars, scrolling is implemented differently. How can I disable the scrollbars programa...

How can I fix my window focus problem?

I have a very frustrating bug in an application I am working on. The routine is supposed to do something in one window, and then return focus to the other at the end of the method, but when I started to use a large data set the other day, the focus stopped returning at the end. I stepped through the code one line at a time, and the error...

Emacs: Auto Complete for C++

Hello, i found this autocompletion for Emacs: http://www.emacswiki.org/emacs/AutoComplete, but I can't find what languages it supports. I want to use it particular for C++-autocompletion. Has anybody experience with this? ...

Visual C++ 2010 solution-wide macros with parameters

I'm trying to compile some source code with Visual C++ 2010 Express. The code was written for GCC, and contains attributes like this: struct something { ... } __attribute__((packed)); Since this is not standard C++ syntax, Visual C++ doesn't recognize it. With this macro prior to the struct declaration, it works fine: #define __attri...

Secured applications

How can Write and Create Safer Windows Applications with lock key ? ...

Does changing the order of class private data members breaks ABI

I have a class with number of private data members (some of them static), accessed by virtual and non-virtual member functions. There's no inline functions and no friend classes. class A { int number; string str; static const int static_const_number; bool b; public: A(); virtual ~A(); public: // got virtual a...

Socket in multiple threads

I have a project where Thread A calls Accept(...) on some socket, then it passes it to another thread, which does receive on the socket and then closes the socket. The object on which accept was called is never closed in Thread A. Is that safe? What happens to that object in Thread A? ...

OpenGL fast texture drawing with vertex buffer objects. Is this the way to do it?

Hello. I am making a 2D game with OpenGL. I would like to speed up my texture drawing by using VBOs. Currently I am using the immediate mode. I am generating my own coordinates when I rotate and scale a texture. I also have the functionality of rounding the corners of a texture, using the polygon primitive to draw those. I was thinking...

Alternative Control Structures

I've been wondering about alternative ways to write control structures like you can write your own language constructs in Forth. One that you learn early on for if statements is a replacement for this: if ( x ) { // true } else { // false } with this (sometimes this is more readable compared to lots of brackets): x ? true : fa...

Beginner question about getting reference to cin

I'm having problems wrapping my head around this. I have a function void foo(istream& input) { input = cin; } This fails (I'm assuming because cin isn't supposed to be "copyable". however, this works void foo(istream& input) { istream& baz = cin; } Is there a reason that I can get a reference to cin in baz but I cannot as...

Is a function reference sizeof portable?

Hi Looking for a way to do a portable, safe, elements count for c-style arrays, I found this solution: template <typename T, unsigned N> char (&arrayCountofHelper(T(&)[N]))[N]; #define ARRAY_COUNTOF(arr) (sizeof(arrayCountofHelper(arr))) It seems like arrayCountofHelper is actually a reference to a function, and the macro ARRAY_COUNT...

How is the syntax for stl iterators implemented?

I've been working on writing a library in my spare time to familiarize myself more with c++ and singular value decomposition. I've been working on writing an Iterator class and I'm entirely capable of writing the functionality and I have already for my own currently MatrixIterator class. I'm guessing that it involves namespaces because: ...

Calling functions from main() in c++

Possible Duplicate: Calling functions from main() in c++ Hello. I have a programme that has about 100 classes and more than 1000 functions spread over 20 header and source code files. What I want to know is that how I can pass arguments to so many functions in so many files? What is the procedure adopted for this in main()? Re...

GCCs atomic builtins - Which processors are supported

This document says: Not all operations are supported by all target processors. Does anybody know, for which processor which operation is supported? ...

Floating point Endianness?

Hi I'm writing a client and a server for a realtime offshore simulator, and, as I have to send a lot of data through a socket, I'm using binary data to maximize the ammount of data I can send. I already know about integers endianness, and how to use htonl and ntohl to circumvent endianness issues, but my application, as almost all simul...

Feedback on iterating over type-safe enums

In response to the earlier SO question "Enumerate over an enum in C++", I came up with the following reusable solution that uses type-safe enum idiom. I'm just curious to see the community feedback on my solution. This solution makes use of a static array, which is populated using type-safe enum objects before first use. Iteration over e...

Obsolete PDB Files generated by DDK

Hi Guys, I have a very simple application in VS.NET 2002 (C++) that calls a function from a DLL. The DLL is built with WINDDK and MSC_OPTIMIZATION is set to /Od /Oi When I try to step into the exported function from the DLL it fails. I then tried to load the symbols from the PDB file generated by WINDDK (XP Checked environment), but I ...

optimistic lock-free FIFO queues impl?

is there any C++ implementation (source codes) of "optmistic approach to lock-free FIFO queues" algorithm? ...