I'm using the work_pile pattern so the threads are always running and waiting on a semaphore for incoming new function pointers + data in a queue. Thats what the apple marketing guys now calls Grand Central Dispatch and promote as the new sliced bread thing.
I just wonder how to find out if it is usefull to split a short task into two ...
math.h is not really a documentation. Is there something else that will describe these functions a but more in detail?
...
I need help of a real C guru to analyze a crash in my code. Not for fixing the crash; I can easily fix it, but before doing so I'd like to understand how this crash is even possible, as it seems totally impossible to me.
This crash only happens on a customer machine and I cannot reproduce it locally (so I cannot step through the code us...
Very much related to my previous question, but I found this to be a separate issue and am unable to find a solid answer to this.
Is the memory used by a (character) array freed by going out of scope?
An example:
void method1()
{
char str[10];
// manipulate str
}
So after the method1 call, is the memory used by str (10 bytes) fre...
We are trying to port our code from HPX to AIX but getting core dump while running exe.
its failing in some unknown function ptrgl_64._ptrgl.
> ptrgl_64._ptrgl() at 0x900000084da0e48
> dfile_Proc(o_record =
> 0x0000000400000004, fileType =
> "^O\377\377\377\377\377TH^O\377\377\377\377\377TQ^O\377\377\377\377\377Ta^O\377\377\377\377\377...
What is efficient way to determine if a list is a subset of another list?
Example:
is_subset(List(1,2,3,4),List(2,3)) //Returns true
is_subset(List(1,2,3,4),List(3,4,5)) //Returns false
I am mostly looking for efficient algorithm and not too concern how the list is stored. It can be stored in array, link list or other data struct...
Hi,
I know that similar questions are posted in SO, but I thought I can ask this in the following the context:
char amessage[] = "now is the time";
char *pmessage = "now is the time";
I read from The C Programming Language, 2nd Edition that the above two statements don't do the same thing.
I always thought that an array is an conven...
I have to write a text image program in C for a class. Nothing complicated just write an image using text.
In regards to this: towel.blinkenlights.nl, how can I animate my text?
...
I have a lot of functions(huge list) defined and compiled. And I use function pointers to call and execute the functions by sending arguments dynamically during runtime. It is an iterative process involving more than hundred thousand function calls every iteration. I want to know which is the efficient way of calling an compiled functio...
Output:
The first file found is LOG_09.TXT
Next file name is LOG_10.TXT
Next file name is LOG_11.TXT
Next fi (cut off word "file"?)
Function:
//Find last modified log file
hFind = FindFirstFile("..\\..\\LOGS\\LOG*.TXT", &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
printf ("FindFirs...
Q1. In Java, all objects, arrays and class variables are stored on the heap? Is the same true for C++? Is data segment a part of Heap?
What about the following code in C++?
class MyClass{
private:
static int counter;
static int number;
};
MyClass::number = 100;
Q2. As far as my understanding goes, variab...
I am using C NOT C++!
I know the C++ collections, but I was wondering if Microsoft has a C based List structure of some type, like the linux kernel provides, that I can use in a user mode project?
I would prefer not rolling my own.
...
I'm trying to compile a C code in a file from a program in C++. When I run my program it call the Tiny C Compiler and generate a dll from the compilation of c code.
I tried to do it by a lot of ways but I couldn't. Did anyone already do something like this?
Thanks
...
In C you can continue a string literal in the next line escaping the newline character:
char* p = "hello \
new line.";
( My C is a bit rusty and this could be non 100% accurate )
But in php, the backslash is taking literally:
$p = "hello \
new line.";
I.E. the backslash character forms part of the string.
Is there a way to get the C ...
What is the best implementation, from a performance point of view, of branched function calls?
In the naive case we have a rather large switch statement that interprets bytecode and executes a function call depending on code.
In the normal case we have computed gotos and labels that do the same thing.
What is the absolute best way t...
I've got a DLL written in C (that I can't edit) that has some function prototype that looks like
#include <stdio.h>
void foo(FILE *bar);
I'd like to create a JNA interface to the DLL and it's unclear what I need to pass for the FILE *bar argument. I assume I need to pass an InputStream (which is my preference), but the JNA literature...
For example:
- (BOOL)compare:(NSDecimal)leftOperand greaterThan:(NSDecimal)rightOperand {
NSComparisonResult result = NSDecimalCompare(&leftOperand, &rightOperand);
// rest not important
}
like you can see, the method just receives these two types of NSDecimal, leftOperand and rightOperand. Then it passes them on to a C API fu...
Hi, I'm stuck at a Segmentation fault after inserting about 8 million records in a TC Hash Database. After everything is inserted I close the DB but I caught a Segmentation Fault at this part of the code (tchdb.c):
static void tchdbsetflag(TCHDB *hdb, int flag, bool sign){
assert(hdb);
char *fp = (char *)hdb->map + HDBFLAGSOFF;
if...
I have alot of different sorting algorithms which all have the following signature:
void <METHOD>_sort_ints(int * array, const unsigned int ARRAY_LENGTH);
Are there any testing suites for sorting which I could use for the purpose of making empirical comparisons?
...
In C, declaring a variable static in the global scope makes it a global variable. Is this global variable shared among threads or is it allocated per thread?
Update:
If they are shared among threads, what is an easy way to make globals in a preexisting library unique to a thread/non-shared?
Update2:
Basically, I need to use a preexisti...