c++

What is private MFC and why are they not accessible through the normal interface ?

I am using MFC for gui development and I stumbled upon a function that could be useful for what I'm trying to do. The function is _AfxCompareClassName. However, it is included in the file "afximpl.h" which is located in the directory "VC/altmfc/src/mfc/afximpl.h". Normal mfc includes are in the directory "VC/atlmfc/include". Now from wh...

IEEE - 754 - find signbit, exponent, frac, normalized, etc..

I am taking in a 8 digit hexadecimal number as an IEEE 754 bit floating point number and i want to print information about that number( signbit, expbits, fractbits, normalized, denormalized, infinity, zero, NAN) floating point should be a single. I read up on bit shifting, and i think this is how i am suppose to do it?. however, i am no...

const <type>& foo() versus <type> foo()

In a non-template class, is there any reason to prefer function return signatures in the form const <type>& foo(); versus <type> foo();? Where <type> is an intrinsic type. What about if <type> is a class/struct object? Also interested in whether or not the function being const makes a difference: const <type>& foo() const; to <type> fo...

Why can't I cause a seg fault?

OK for whatever reason I'm having trouble causing a seg fault. I want to produce one so that I can use gdb to see how to debug one. I have tried both examples from the Wikipedia article yet neither work. The first one: char *s = "Hello World!"; *s = 'H'; And the second example: int main(void) { main(); } EDIT: I'm using Ubutn...

How to initialise a std::map once so that it can be used by all objects of a class?

Hi, I have an enum StackIndex defined as follows: typedef enum { DECK, HAND, CASCADE1, ... NO_SUCH_STACK } StackIndex; I have created a class called MoveSequence, which is a wrapper for a std::deque of a bunch of tuples of the form <StackIndex, StackIndex>. class MoveSequence { public: void AddMove( ...

How to save settings in gdb?

Hello, Does anyone know how to save gdb settings (like "set print pretty on" or "set print elements 0", both from here)? I don't want to set my configuration every time that I will use gdb :/ I searched in google and SO, but I found nothing. Thanks. ...

Discrete Wavelet Transform integer Daub 5/3 lifting issue

Hi there. I'm trying to run an integer-to-integer lifting 5/3 on an image of lena. I've been following the paper at http://www.uwec.edu/walkerjs/media/research_signpost_article.pdf I'm running into issues though. The image just doesn't seem to come out quite right. I appear to be overflowing slightly in the green and blue channels ...

issues concerning a byte array to a long long(64 bit) array vs a long (32 bit)

I have a byte array that has hex values and I initially put those values in a unsigned long. I am using a 32 bit processor via Ubuntu at the moment. But, i might have to port this program to a 64 bit processor. now I am aware of strtoul function but since I was able to convert it would any issues via a direct assignment I did not bothe...

Memoization in static Objective-C class

Say I have a class method like + (double)function:(id)param1 :(id)param2 { // I want to memoize this like... static NSMutableDictionary* cache = nil; // // test if (param1,param2) is in cache and return cached value, etc. etc // } Thanks!! ...

Developing C wrapper API for Object-Oriented C++ code

I'm looking to develop a set of C APIs that will wrap around our existing C++ APIs to access our core logic (written in object-oriented C++). This will essentially be a glue API that allows our C++ logic to be usable by other languages. What are some good tutorials, books, or best-practices that introduce the concepts involved in wrappin...

Abstract classes issue in C++ undo/redo implementation

I have defined an "Action" pure abstract class like this: class Action { public: virtual void execute () = 0; virtual void revert () = 0; virtual ~Action () = 0; }; And represented each command the user can execute with a class. For actual undo/redo I would like to do something like this: Undo Action a = historyStack.p...

How do I start a new CUDA app in visual studio 2008?

This is an incredibly basic question, but how do I start a new CUDA app in visual studio 2008? I have found tons and tons of documentation about CUDA related matters, but nothing about how to start a new project. I am working with Windows 7 x64 Visual Studio 2008 C++. I would really like to find some sort of really really basic Hello ...

basic question of C++

I just found that I am confused about one basic question in C++ class Base { }; class Derived : public Base { } Base *ptr = new Derived(); What does it mean? ptr is pointing to a Base class or Derived class? At this line, how many memory is allocated for ptr? based on the size of Derived or Base? What's the difference between th...

Using ZODB directly from C++. Examples and design hints.

I'd like to use ZODB directly from C++ and don't want to write Python code for that. Have you had any experience doing so? If I were to use C++ for GUI and quering/writing data from/to ZODB, how the design should be? ...

from file object to file name

Hi, I wonder if we can get the file name including its path from the file object that we have created for the file name in C and in C++ respectively FILE *fp = fopen(filename, mode); // in C ofstream out(filename); // in C++ ifstream in(filename); // in C++ Thanks! ...

write and read object of class into and from binary file

Hi, I try to write and read object of class into and from binary file in C++. I want to not write the data member individually but write the whole object at one time. For a simple example: class myc { public: int i; myc(int n) {i = n; } myc(){} void read(ifstream *in){in->read((char *) this, sizeof(myc));} void...

How might one create an extra worker thread for a single threaded GUI application?

I am currently developing new features for an existing VCL application. The application creates charts and static images using a thirdparty package called TeeChart. There is one instance where I have to load in 2 million data points to create a static image chart. However, this takes a while to load and the user can't do anything in the ...

Limit the confusion caused by undefined-behavior?

As I understand from my reading, undefined-behavior is the result of leaving the compiler with several non-identical alternatives at compile time. However, wouldn't that mean that if one were to follow strict coding practice (like putting each assignment and each equality in a separate statement, proper debugging and commenting) then it...

Hackable scheme implementation with decent C++ FFI

I have tried: scheme48, chicken, gambit, clojure. I am looking for a scheme implementation that's readable (the implementation itself), and has a decent C++ ffi, and good debugging suport (so when I get an exception, I should get popped into a recursive repl). What suggestions do people have? ...

Boost library for RTTI

Hi, which boost library should I use to implement RTTI in my project?? Is it Statechart library? Thanks and Regards, Jabez. ...