c++

Why does endl get used as a synonym for "\n" even though it incurs significant performance penalties?

This program: #include <iostream> #include <cstdlib> #include <string> int main(int argc, const char *argv[]) { using ::std::cerr; using ::std::cout; using ::std::endl; if (argc < 2 || argc > 3) { cerr << "Usage: " << argv[0] << " [<count>] <message>\n"; return 1; } unsigned long count = 10000; if (arg...

how i can take the local properties?

Hello, I am trying to write and lock a program with wxwidgets, but i dont know how i can take the local properties with wxwidget framework. Any idea? I use code::blocks. Thank's Jim ...

Application does not start in debugger

The application I'm working does not start in the debugger of Visual Studio 2005. Here's what I do: I rebuild the application and hit F5 to start it The title of the VS2005-window says "projectname (Running) ..." The debugger buttons appear but are greyed out The application appears in the Windows task manager, but it has only 80k in ...

What does this stack trace possibly mean?

Hi, I'm having segfault problem in my application written using C++ and compiled using GCC 4.3.2. It is running under Debian 5 x64. The process crashed on the following line of code: #0 0x00000000007c720f in Action::LoadInfoFromDB (this=0x7fae10d38d90) at ../../../src/server/Action.cpp:1233 1233 m_tmap[tId]->slist[sId]...

In wxwidgets, how do I make one thread wait for another to complete before proceeding?

I have a system where my singleton class spawns a thread to do a calculation. If the user requests another calculation while another calculation is still running, I want it to tear down the existing thread and start a new one. But, it should wait for the first thread to exit completely before proceeding. I have all the tear down working ...

why c++wt is not integrated with ExtJs 3.x ? and how is it possible to integrate it with that?

hi , I just wondering why wt (the WebToolkit for c++) is not integrated with ExtJs 3.x whereas it is still using extJs 2.x. and how is it possible to integrated it with the updated version of extjs I want to use some updated widget out of extjs 3.0 with the help of wt but unfortunately there is no chance :( regards. ...

Are object files platform independent ?

Is it possible to compile program on one platform and link with other ? What does object file contain ? Can we delink an executable to produce object file ? ...

Where does my C++ compiler look to resolve my #includes?

Hi, this is a really basic question. I've been learning C++ and thus far I have only used the standard library. I have been including things like <iostream> and with no problems. Now I want to use Apache Xerces, so I've installed it on my machine (a Debian system) and am following a tutorial which says I need to include: #include <x...

Dump class/struct member variables in g++

Is there a flag in g++ or tools to dump the member variables of a struct/class? To illustrate, consider source code like this struct A { virtual void m() {}; }; struct B : public A { int b; virtual void n() = 0; }; struct C : public B { int c1, c2; void o(); }; struct D : public C { virtual void n() {}; A d; }; I want to get something...

The problem with header files.

I have 3 header files in the project: Form1.h - this is header with implementation there, TaskModel.h with TaskModel.cpp, TaskController.h with TaskController.cpp. There are content of files: //----- TaskController.h #pragma once #include "TaskModel.h" .......... //---- Form1.h #pragma once #include "TaskModel.h" #include "TaskCo...

concurrent reference counter class and scoped retain: is this ok ?

This is a question regarding coding design, so please forgive the long code listings: I could not resume these ideas and the potential pitfalls without showing the actual code. I am writing a ConcurrentReferenceCounted class and would appreciate some feedback on my implementation. Sub-classes from this class will receive "release" inste...

OpenGL: GL_LINE_SMOOTH not supported on all cards; wont even draw the lines, unless...

First of all, whats the purpose of this code? glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); I could put there GL_DONT_CARE but it doesnt make my lines drawn, unless i use glDisable(GL_LINE_SMOOTH) So im asking if theres some built in mechanism to make it draw the lines even if the smooth lines arent supported (So it would draw them withou...

C++ container/array/tuple consistent access interface

hello Is there, perhaps in boost, consistent element access semantics which works across containers? something along the lines of: element_of(std_pair).get<1>(); element_of(boost_tuple).get<0>(); element_of(pod_array).get<2>(); in principle i can write myself, but I would rather not reinvent the wheel.thanks ...

Call dll - pcshll32.dll using delphi

Hi, I need to call hllapi function of pcshll32.dll using delphi. It's works with personal communications of ibm. How can i change the code bellow to delphi ? Thanks !!! The EHLLAPI entry point (hllapi) is always called with the following four parameters: EHLLAPI Function Number (input) Data Buffer (input/output) Buffer Length (input...

Manipulating scrollbars in third-party application.

Hello, I need to create an application which do the following: At the beginning we have notepad window open with a lot of text in it. Our application must scroll through this file and take notepad window screenshot after each scroll action. I've tried to achieve this using SBM_GETRANGE, SBM_GETRANGE, SBM_SETPOS but it does not work f...

C++ preprocessor __VA_ARGS__ number of arguments

Simple question for which I could not find answer on the net. In variadic argument macros, how to find the number of arguments? I am okay with boost preprocessor, if it has the solution. If it makes a difference, I am trying to convert variable number of macro arguments to boost preprocessor sequence, list, or array for further reproce...

Controlling cursor and keyboard with C++/Visual C++

Hello This time I have a question about C++. I'm using Dev-C++ for programming, but I also have Visual C++ Express installed so both are good. I'm creating a program like automated tasks, is it.. macro? But as I'm a noob in C++, because I started it a week ago, I need help. Please keep the answers simple :-D This is a part of my learnin...

How to ensure a member is 4-byte aligned ?

In order to use OSAtomicDecrement (mac-specific atomic operation), I need to provide a 4-byte aligned SInt32. Does this kind of cooking work ? Is there another way to deal with alignment issues ? struct SomeClass { SomeClass() { member_ = &storage_ + ((4 - (&storage_ % 4)) % 4); *member_ = 0; } SInt32 *member_; struc...

Which language should i use for next project?

Hi, my parents asked me what if I could do a simple program for accounting. The thing is, I can not decide which programming language to choose. I know Java quite well but don't like messing with GUI, so I'm leaning towards C#/C++/Delphi because there you can make the gui in no time. The only problem I have I don't know how I would prin...

Atomic increment on mac OS X

I have googled for atomic increment and decrement operators on Mac OS X and found "OSAtomic.h", but it seems you can only use this in kernel space. Jeremy Friesner pointed me at a cross-platform atomic counter in which they use assembly or mutex on OS X (as far as I understood the interleaving of ifdefs). Isn't there something like Int...