Possible Duplicate:
Why do we need extern C{ #include <foo.h> } in C++?
I have often seen programs coded like:
extern "C" bool doSomeWork() {
//
return true;
}
Why do we use extern "C" block? Can we replace this with something in C++ ? Is there any advantage of using extern "C" ?
I do see a link explaining this but why d...
I am using aspell in my application for spell checking (a c/c++ app), and I want to use it to find best alternatives in a custom work list. I don't want to use a standard dictionary, as I only want to find words in my word list. I can find ways of adding words to a dictionary (aspell_speller_add_to_personal and aspell_speller_add_to_se...
Sorry this is probably a stupid question, as I couldn't find anything at all on google on the subject. Anyways I'm trying to compile some source code, that uses boost::array with visual studio 2005, as a Win32 console application (not clr), however for some reason that escapes me Visual Studio still considers the word array a keyword, so...
Greetings, everyone!
I have a c++ code, where the following enum is declared:
enum Some
{
Some_Alpha = 0,
Some_Beta,
Some_Gamma,
Some_Total
};
int array[Some_Total];
The values of Alpha, Beta and Gamma are sequential, and I gladly use the following cycle to iterate through them:
for ( int someNo = (int)Some_Alpha; someN...
Hello everyone,
I have a huge array of ints that I need to sort. The catch here is that each entry in the list has a number of other associated elements in it that need to follow that int around as it gets sorted. I've kind of solved this problem by changing the sorting to sort doubles instead of ints. I've tagged each number before it...
If I call a virtual function 1000 times in a loop, will I suffer from the vtable lookup overhead 1000 times or only once?
...
In Java, updating double and long variable may not be atomic, as double/long are being treated as two separate 32 bits variables.
http://java.sun.com/docs/books/jls/second_edition/html/memory.doc.html#28733
In C++, if I am using 32 bit Intel Processor + Microsoft Visual C++ compiler, is updating double (8 byte) operation atomic?
I ca...
I have some work items pooled using the legacy QueueUserWorkItem function (I need to support OSs earlier than vista, so
for( <loop thru some items >)
{
QueueUserWorkItem( )
}
I need to wait on these before proceeding to the next step.
I've seen several similar answers...but they are in .NET.
I'm thinking of using a storing an E...
I'm working on a program that creates 2000 directories and puts a file in each (just a 10KB or so file). I am using mkdir to make the dirs and ofstream (i tried fopen as well) to write the files to a solid state drive (i'm doing speed tests for comparison).
When I run the code the directories are created fine but the files stop writing ...
Why does STL work with a comparison function that is strict weak ordering? Why can't it be partial ordering?
...
We utilise multicasting in our application to efficiently broadcast updates to clients connected to middle-tier(s). I'm continually asked by network engineers about "how our multicasting works" and what multicast protocols it supports. I'm puzzled by these type of questions, in that as far as I'm concerned, our client processes simply ...
I have a multithreaded application that runs using a custom thread pool class. The threads all execute the same function, with different parameters.
These parameters are given to the thread pool class the following way :
// jobParams is a struct of int, double, etc...
jobParams* params = new jobParams;
params.value1 = 2;
params.value2 ...
Hi,
I'm trying to compile simple example to use the boost concept_check
Code is as follow:
#include <vector>
#include <complex>
#include <algorithm>
#include <boost/iterator.hpp>
#include <boost/concept_check.hpp>
template <class foo>
void my_do_sort(std::vector<foo>& v)
{
BOOST_CONCEPT_ASSERT((RandomAccessIterator<foo>));
std:...
Why I get the following warning for the following code :)
Code:
_stprintf(m_szFileNamePath,_T("%s"),strFileName);
warning C4996: '_swprintf': swprintf has been changed to conform with the ISO C standard, adding an extra character count parameter. To use traditional Microsoft swprintf, set _CRT_NON_CONFORMING_SWPRINTFS.
I know _s...
I need to provide synchronization to some members of a structure.
If the structure is something like this
struct SharedStruct {
int Value1;
int Value2;
}
and I have a global variable
SharedStruct obj;
I want that the write from a processor
obj.Value1 = 5; // Processor B
to be immediately visible to the other proce...
I have a template class defined as follow :
template <class T1, class T2>
class MyClass { };
In this class, I need a struct that contains one member of type T1. How can I do that ?
I tried the following, but it didn't work :
template <class T1, class T2>
class MyClass {
typedef struct {
T1 templateMember;
// rest...
I'm trying to create a lookup table of member functions in my code, but it seems to be trying to call my copy constructor, which I've blocked by extending an "uncopyable" class. What I have is something like the following.
enum {FUN1_IDX, FUN2_IDX, ..., NUM_FUNS };
class Foo {
fun1(Bar b){ ... }
fun2(Bar b){ ... }
...
void (Foo...
If I have a.o, b.o, and c.o, how do I make ld link them into d.o, which is then linked into my main object file? All that I want to have happen is that all the symbols in the input files get combined into one big output file.
...
How should i know at print server whether any client has fire any command. or any way to hook into printer driver at printing driver at server
What is print server ???
How print server work in Window???
How muliple client will send request to single print server???
Is any utility is running???
Can anybody clear me on this things???
...
Hello!
I have a Windows service which starts another application using CreateProcess. Thus, the application runs with SYSTEM privileges. This application calls LsaEnumerateLogonSessions, which returns the error code 8 (Not enough storage is available to process this command.). The service and the application are run under Windows 7 x64....