c++

Can inner classes access private variables?

class Outer { class Inner { public: Inner() {} void func() ; }; private: static const char* const MYCONST; int var; }; void Outer::Inner::func() { var = 1; } const char* const Outer::MYCONST = "myconst"; This errors out when I compile with class Oute...

Class design suggestions - C++

Background I am working on a phonetic converter program which converts english text into equivalant regional language text. Regional languages will have more characters than english letters and regional language fonts uses almost all positions (1-255) in a font. My program supports different fonts and I have created a font class which...

How to check if a Server and Client are in the same concurrency model?

The concurrency model can be either apartment-threaded or multi-threaded Question: How to ensure that both the Client and Server are operating from within the same concurrency model? ...

Where can I find MSCVR80.DLL v8.0.50727.3053 ??

I've got a bug from one of our customers and believe that the problem lies with MSVCR80.DLL v8.0.50727.3053 - a version which I cannot find for download anywhere, however a google search turns up plenty of other crash reports. Latest version on my system (and others here) is 8.0.50727.1433 and the Microsoft Visual C++ 2005 SP1 Redistrib...

Basic C++ question regarding scope of functions

I'm just starting to learn C++ so you'll have to bear with my ignorance. Is there a way to to declare functions such that they can be referenced without being written before the function that uses them. I'm working with one cpp file (not my decision) and my functions call themselves so there is not really a proper order to place them in....

How does template argument shadowing work in VS2005?

In GCC this code won't compile, because T gets shadowed, however in VS2005 it compiles with no warnings, so what are the assumptions VS compiler is making? template<typename T> class Foo { template<typename T> void Bar(const T& bar) { ... } }; ...

Is there a correct way to avoid warnings when comparing two different enums?

When comparing enums that come from different sources such as those of the following code GCC emits warnings. Is there a way to avoid these warnings without c-style casts? struct Enumerator { enum { VALUE = 5 }; }; template<int V> struct TemplatedEnumerator { enum { VALUE = V }; }; if(Enumerator::VALUE == TemplatedEnumerator<5...

Variable height items in Win32 ListView

Is it possible to have variable size (owner draw) items in the Win32 ListView, if yes, how? ...

Dynamic Polymorphism and Dynamic Memory Allocation

Is it always necessary to allocate memory from the heap to facilitate dynamic polymorphism? All the examples i've come across so far point to the same. Dynamic memory allocation is usually avoided in real-time-programming.So,is there any disadvantage of using the stack for dynamic polymorphism as shown in the code below. class Base { ...

Use c++ to access internet explorer

Well as the topic says, I want to know if there is a tool or a tutorial that can help me access IE, get in a certain URL, do some action on that website. So I would have a program to do that for me instead of doing it myself every time. ...

What is an analog for win32 file locking in boost::interprocess?

What sync mechanism should I use to give exclusive access to the text file in boost? The file will likely be accessed by threads from only one process. ...

How to Convert 64bit Long Data Type to 16bit Data Type.

I am curious to know How to Convert 64bit Long Data Type to 16bit Data Type. As this feature is required in the Ethernet Application to include Time Stamp. We left with only 2Bytes [16bits] to include Time Stamp. We get 64bit long the Time Stamp from Win API. Any answer will be highly appreciated. Thank you. ...

Difference between const declarations in C++

What is the difference between void func(const Class *myClass) and void func(Class *const myClass) See also: http://stackoverflow.com/questions/269882/c-const-question http://stackoverflow.com/questions/455518/how-many-and-which-are-the-uses-of-const-in-c and probably others... ...

How to supress specific warnings in g++

I want to suppress specific warnings from g++. I'm aware of the -Wno-XXX flag, but I'm looking for something more specific. I want some of the warnings in -Weffc++, but not all of them. Something like what you can do with lint - disable specific messages. Is there a built in way in gcc to do this? Do I have to write a wrapper script? ...

C/C++ Header file documentation

Hi! What do you think is best practice when creating public header files in C++? Should header files contain no, brief or massive documentation? I've seen everything from almost no documentation (relying on some external documentation) to large specifications of invariants, valid parameters, return values etc. I'm not sure exactly wha...

Implementation in global functions, or in a class wrapped by global functions

I have to implement a set of 60 functions, according to the predefined signatures. They must be global functions, and not some class's member functions. When I implement them, I use a set of nicely done classes provided by 3rd party. My implementation of most functions is quite short, about 5-10 lines, and deals mostly with different ac...

Storing and Retrieving Dynamically Changing Structures

I am creating a game using Allegro/C++. The game is almost done and now, I want to create a map editor. The game contains numerous classes and their number will vary depending on the number of objects the map requires. I was thinking of creating a separate structure to hold level data and store it as a map. The problem is that the size v...

Shut down a ATL application cleanly

Hi all, I am a complete newbie to C++ so bear with me ;-) I have developed a console ATL application and want to trap the close?, exit?, terminate? event so that I can close log files and perform a general cleanup on exit. How can I trap the 'terminate' event that would result from someone ending the .exe in the task manager? Appreci...

Error in QSqlTableModel inherited table.

Hi! I have this class that inherits from QSqlTableModel and it brokes after calling the submitAll() slot, after calling insertPoint some times. Here is the code. Thanks for the help. Regards. #ifndef VWLANDMARKTABLEMODEL_H #define VWLANDMARKTABLEMODEL_H #include class GraphicsPointLandmarkItem; class VWLandmarkTableModel : public...

Making a C++ app scriptable

I have several functions in my program that look like this: void foo(int x, int y) Now I want my program to take a string that looks like: foo(3, 5) And execute the corresponding function. What's the most straightforward way to implement this? When I say straightforward, I mean reasonably extensible and elegant, but it shouldn't t...