c++

Real time dynamic shadows to compliment deffered shading?

I currently have a deffered rendering system setup and can render point lights and directional lights. My question is what are my options for different forms of shadowing which can make shadows based on point lights and directional lights which can maybe make use of a deffered shading setup? ...

mmap to overlay VME bus into user space memory over a PCI?

I'm trying to map a VME address space through a PCI bus into user space so I can perform regular read/writes on the memory. I have done this with another PCI device like this :- unsigned long *mapArea(unsigned int barAddr, unsigned int mapSize, int *fd) { unsigned long *mem; *fd = open("/dev/mem", O_RDWR); if ( *fd<0 ) { ...

What may cause DefWindowProc to stop processing messages ?

Hi, I encountered strange behaviour of my application. I would like to close frame window in MDI application, so I send WM_SYSCOMMAND (SC_CLOSE) to that window. After that, I receive OnSysCommand. Then I call CMDIChildWnd::OnSysCommand to proceed processing. The problem is, that sometimes base implementation of OnSysCommand calls OnCl...

In C++, if throw is an expression, what is its type?

I picked this up in one of my brief forays to reddit: http://www.smallshire.org.uk/sufficientlysmall/2009/07/31/in-c-throw-is-an-expression/ Basically, the author points out that in C++: throw "error" is an expression. This is actually fairly clearly spelt out in the C++ Standard, both in the main text and the grammar. However, what...

How to acquire an event only at defined times?

I have a QWidget which handles the mouseevent, i.e. it stores the mouseposition in a list when the left mouse button is pressed. The problem is, I cannot tell the widget to take only one point every x ms. What would be the usual way to get these samples? Edit: since the mouseevent is not called very often, is it possible to increase th...

How is heap and stack memories mananged, implemented, allocated

Possible Duplicates: How is heap and stack memories mananged, implemented, allocated? Stack,Static and Heap in C++ In C/C++ we can store variables, functions, member functions, instances of a class either on a stack or a heap. How is each implemented? How is it managed (high level)? Does gcc preallocates a chunk of memory to...

Boost.Intrusive and unordered_map

I am looking to use an intrusive unordered_map. For some reason there is only an unordered_set in the library. There is also an intrusive hashtable but I'm not sure it has the same functunality, also it doesn't have the same interface. Am I wrong and I missed the unordered_map link? If I am not is there a tutorial that will help me imple...

Can template polymorphism be used in place of OO polymorphism?

I am trying to get my head around applying template programming (and at some future point, template metaprogramming) to real-world scenarios. One problem I am finding is that C++ Templates and Polymorphism don't always play together the way I want. My question is if the way I'm trying to apply template programming is improper (and I sho...

What is malloc doing in this code?

Could you explain following code? str = (char *) malloc (sizeof(char) * (num+1)); What's is malloc? Why num + 1? ...

Why won't C++ allow non-const to const conversion in copy ctor?

I have two getter members: Node* prev() { return prev_; } int value() { return value_ } Please note the lack of const identifiers (I forgot them, but now I want to know why this won't work). I am trying to get this to compile: Node(Node const& other) : prev_(other.prev()), value_(other.value()) { } The compiler rejects this. I tho...

LoadString works only if I don't have an English string table

I want to be able to modify the application's language programatically, or at least use the language specified in Control Panel -> Regional and Language Options -> Formats. If I add an english string table, make a french and a german copy of it, and delete the english one, I can programatically switch between loading the french and the ...

How to manage large buffer in C++?

If I need a large buffer in my program written in C++, which one is better? Allocate the buffer in heap, and keep a reference to that buffer in the class that use it. Allocate a static buffer, and make it global. ...

Visual c++ redistributable redistribution

I'm coming from a Linux background, but I'd like to provide a version of my software on Windows. For users to run my program, they will need the Visual C++ redistributable. I would like to provide it for them as part of the package. My worry is that there, in the future, will be an SP2 of the Visual Studio 2008 Redistributable. If I ...

C++ compile errors in Unicode Release MinDependency but not in Debug

Let me start out by saying I'm in charge of the creating and managing the builds and installs and I'm not a C++ developer so most of the errors below are incomprehensible to me. That being said a developer (not around right now) checked in some code that compiles fine in Debug|Win32 (using VS08) but I need to get it to compile in Unicod...

Profile single function in gprof

Is it possible to use gprof to line-profile a single function in C++? gprof -l -F function_name ... does not seem to work. Thanks, Bi. ...

Can we take advantage of the type system to make programs more secure?

This question is inspired from Joel's "Making Wrong Code Look Wrong" http://www.joelonsoftware.com/articles/Wrong.html Sometimes you can use types to enforce semantics on objects beyond their interfaces. For example, the Java interface Serializable does not actually define methods, but the fact that an object implements Serializable sa...

Disabling the keyboard in windows c++?

How can I completely disable the keyboard using c++ in windows? And by completely disable I mean so even ctrl+alt+delete doesn't work. I did consider using a keyboard driver but I think you need to restart the computer after it is installed, but since I only need to disable it for a couple minutes that wouldn't really work. ...

Dev-C++ include file paths FLTK(Fast Light Toolkit)

When I compile and run programs in Bloodshed I save everything into a a folder labeled C++ in my username folder. When I downloaded FLTK, extracted it to the C++ folder, then tried to run a program using header files from FLTK, it was unable to find the files. My guess is that when the compiler looks for the header files it's only lookin...

windows: load a filter driver while windows is running

Is it possible to install a keyboard filter driver(like ctrl2cap) while windows is running and not having to reboot? I tried it once with a driver loader but I got a BSOD. If it is possible what was I doing wrong? What can I do next time to not get a BSOD? Also, if it is possible, could I do it with c++? Thanks for the help! ...

guidelines on usage of size_t and offset_t ?

This is probably a C++ 101 question: I'm curious what the guidelines are for using size_t and offset_t, e.g. what situations they are intended for, what situations they are not intended for, etc. I haven't done a lot of portable programming, so I have typically just used something like int or unsigned int for array sizes, indexes, and th...