General C++ Programming - August 2011 (Page 22)

Can we control the order in which two threads are executed
 
Say I have two threads P and C. I want the execution to follow the P C P C P C pattern. In order words, the execution of the two threads should alternate and no...
[9 replies] Last: Thank you all so much. Your input was very helpful. My program has def... (by vasiqshair)
by mof
Using BOOL as threadlock (1,2)
 
Hello, I've written my first multithreaded app (a directshow filter) but I have a question about the way I lock the data transfers. I am using a simple bool ...
[20 replies] Last: Well my thread aware filter is working. It involves 3 threads and two ... (by mof)
Please explain this small code
 
#include<iostream> using namespace std; class area { double dim1, dim2; public: void setarea(double d1, double d2) { dim1= d1; dim2 = d2; ...
[4 replies] Last: As Syuf said, derived classes can use (some of) the methods declared i... (by andywestken)
Parse Split Delimited str.
 
EDIT:: Here is a literal example of what I need. There will be a CSV file that is formatted like the following: FName,MInitial,LName,Description,Comment FN...
[7 replies] Last: Yeah, kind of. I wanted to be able to repeat the variables as well. I ... (by JeremyMH)
Using Peterson's solution for mutual exclusion
 
The idea was to have the producer thread run BEFORE the consumer thread. Always. But my program runs the consumer thread before the producer sometimes. I have u...
[1 reply] : use condition variable together with mutex http://www.cs.loyola.edu/~j... (by agile)
string and sprintf()
 
Hello, I've a got a question. How can I use std::string object as the first argument of sprintf(), i.e. write to std::string using the C function sprintf() ins...
[8 replies] Last: The snprintf () function is C99, and it has some issues. http://linux... (by Duthomhas)
by liwei
test
 
#define CFA_INFRA_LOG_SOURCE 1 #include <CFAInfra/logging/Logging.hpp> #include <iostream> #pragma warning( disable : 4231 ) #include <log4cxx/logger.h>...
[1 reply] : What's the question? Also use code tags. See http://www.cplusplus.co... (by webJose)
File's icon
 
#include <windows.h> #define IDI_ICON1 101 char title ="New Window"; LRESULT CALLBACK P(HWND A,UINT B,WPARAM C,LPARAM D){ switch(B){ case 0x2: Pos...
[10 replies] Last: You edited winuser.h to add hIconSm to WNDCLASS? You should never c... (by andywestken)
DirectX9 Assistance Required
 
I'm working on a wrapper for DirectX9, and it's coming along nicely. My current objective is to construct a handler for lights. However, IDirect3DDevice9::SetL...
[2 replies] Last: That clears things up :) Thanks, Quirk. Wazzak (by closed account zb0S216C)
STL
 
who body can find what is wrong in this code : template<class f, class h, class g> struct myfun : public unary_function<typename g::argument_type, typename f:...
[11 replies] Last: oh oh oh very very very bad mistake X_X tnx and tnx all my friend (by ahura24)
const and casting
 
Okay, for an intellectual exercise, I was digging in to the C++ spec. I was attempting to see how modifying a value stored in a const worked with my compiler. ...
[1 reply] : The compiler must have exchanged your references of constant i with it... (by webJose)
intellisense not working for some pointers
 
Hi guys. I have a problem with intellisense. I have written a class with pointers to the members, but for some of them intellisense doesn't work. I know that if...
[7 replies] Last: Thanks a lot for your guide. I didn't know about inline files. Can I a... (by soheilghafurian)
code optimization question
 
Using my game as an example again... Is passing a variable such as HDC everytime a common function is called or creating a variable in the class and only ini...
[2 replies] Last: oh ok. thank you. Ill just leave it as is then. (by closed account zwA4jE8b)
by kkg
Help with library implementation
 
Hi all, I'm attempting to write a program that will compute the FFTs of a data set 32 point accross the band froma user-specified file and will output the r...
[no replies]
by Chathu
Arrays of char
 
Hi, This Is A Question About Arrays. Plz I need Help.This Is A Simple Code I Wrote. #include<iostream> #include<cstdlib> #include<iomanip> using namesp...
[2 replies] Last: Thanks a Lot For Your Help!!! (by Chathu)
Undefined reference???
 
I don't understand this error on gcc, mingw. // this stuff is in a separate file. namespace prog { enum progState { goodState, ...
[4 replies] Last: Static class members have to be both declared and defined. The problem... (by helios)
Default value in functions
 
If I create a function with default value inputs like this prototype: void F(int a = 0, int b = 1, int c = 2); And I want to call this function with default v...
[1 reply] : Unfortunately, you can't do this -> F(2, ,3); A simple solution wou... (by m4ster r0shi)
const struct member in aggregate definition
 
The other day I updated the contents of a cpp file containing assorted static data definitions to tighten up the const-ness of the assorted string; from const ...
[1 reply] : C++ Standard section 8.5.1 wrote: An aggregate is an array or ... (by hamsterman)
Division by 100 Precision
 
I have this code below: ---> long decimal = 57; long decimal_divider_ = 100; double dval = ((double) decimal / (double) decimal_divider_); <--- I am...
[1 reply] : Floating point math is not exact. (by Zhuge)
Deleting Static Library Asset
 
So here's the deal: I've got a static character reference array which is an asset of a library I'm building. It's a global variable, and static so that it can o...
[2 replies] Last: So there's no reason to deallocate it? That makes sense. Thanks! (by Gatleos)
August 2011 Pages: 1... 2021222324... 29
  Archived months: [jul2011] [sep2011]

This is an archived page. To post a new message, go to the current page.