c

Floating point issue in C

Possible Duplicate: strange output in comparision of float with float literal float a = 0.7; if (a < 0.7) ; Why does the expression here evaluate to true? ...

How are "out parameters" represented for Seed JavaScript GObject bindings?

I've just started using Seed for development. One thing that Seed's web page mentions is that it "Maps C-isms (say, out arguments, or enums) to things that make sense in JavaScript." Unfortunately, I can't find any documentation or examples for how out arguments should work. So, for example, the following call in Seed: window.get_size()...

C++ cross platform USB library?

Hey all I'm (going to be) writing an application in Qt that will run on the 3 main OSes (Windows, Linux and Mac). One of the features of this app is that it needs USB to talk to a piece of custom external hardware. Would anyone know of a cross platform USB library so porting is as easy as possible? Or am I going to be slugging it out on...

Peformance on arrays or matrices...

I was talking to a friend today.. and he told me something that I don't know if it is true, so I decided to ask it here. He has this huge matrix where he has items like this: 1 2 3 4 .. 1000 1001 ...... 2000 2001 ...... 3000 .... Anyway.. he was saying that it is more efficient to traverse it 1 2 3 4.. in C, because in C the array i...

GCC preprocessor

Possible Duplicate: gcc preprocessor Is there a gcc option to make the gcc preprocessor generate C source code but filter out irrelevant source code? For example, a C file has #define switch to define for many different platforms. I'm only intersted in one platform, so I want the C preprocessor to filter out unrelated code. Do...

accessing code space on memory?

is it possible but I guess that memory is read only. I tried something like that void (*b)(); b = *test; char * z = (char * )b; and when I print contents of z, it prints constants from test function. but that memory is read only and I get segfaults when I edit them and call test. I tried this. char x[100]; for(i=0; i<100; i++) x[...

C structs strange behaviour

Hi, I have some long source code that involves a struct definition: struct exec_env { cl_program* cpPrograms; cl_context cxGPUContext; int cpProgramCount; int cpKernelCount; int nvidia_platform_index; int num_cl_mem_buffs_used; int total; cl_platform_id cpPlatform; cl_uint ciDeviceCount; cl_int...

bit swapping with char type in C

the data type is char, and the pattern is follow: source byte: [0][1][2][3][4][5][6][7] destination: [6][7][4][5][2][3][0][1] for example, if I pass a char, 29 to this function, it will do the swapping and return a char type value, which is 116. How can I do the swapping? thank you. ======================== Just wondering if I can...

call of a function in another function in C

Hello everyone, I was wondering how I could call a function in an other function in C. For example, I created the function : void speed (int argc, char** argv) from a hyperterminal, I type 1 or 2 and I get something written on the hyperterminal. In another function called: void menu (int argc, char ** argv) I want to call the pre...

What is the definition of Incomplete Type and Object Type in C?

What is the definition of Incomplete Type and Object Type in C? Also, could you provide some examples of each? ANSI C99 mentions both type categories in various places, though I've found it difficult to understand what each of them means exactly (there is no paragraph/sentence explicitly defining what they are). ...

STM32 printf problem

* UPDATE * here is what I found. Whenever I had that function in there it wouldnt actually make the code lock up. what it would actually do is make the Read RTC I2C function very slow to execute but the code would still run properly, but I had to wait a really long time to get past everytime I read the RTC. so what ended up happening wa...

AVL Tree insertion

How do I calculate the balance factor for a particular node, when I am recursively calling an insert function for adding a node to an AVL tree. I haven't started on the rotation logic. I simply want to calculate the balance factors. In my current attempt, I am forced to store heights of left & right subtrees as I can't find the balance...

How to circular shift an array of 4 chars?

I have an array of four unsigned chars. I want to treat it like a 32-bit number (assume the upper bits of the char are don't care. I only care about the lower 8-bits). Then, I want to circularly shift it by an arbitrary number of places. I've got a few different shift sizes, all determined at compile-time. E.g. unsigned char a[4] = {0x...

how to program high level concepts (i.e. Object class, and Generics) in C

Here lately I've been tinkering around with my own languages as well as reading various writings on the subject. Does anyone have any good advice on how, in C (or Assembler), do you program the concept of the Object Class and/or the concept of Generics into a language. (referring to the Java implementations of Object and Generics) For...

how to find a point which is furthest from a set of points(in 2 D)

plz help me its very urgent ...

g++ static library depends on dynamic libraries

I have some static library. for example libpuchuu.a it depends on dynamic library. for example libSDL.so (but of cource I have libSDL.a) Creation of libpuchuu.a is simple: ar -rcs object_file_1.o object_file_2.o But I can't link my project with libpuchuu.a! undefined references attack my console! At some forum I have found such sente...

Compiling/Linking OpenCV Sample: camshiftdemo.c

I built the demo on my Ubuntu 10.04 using the headers found in this PPA and with the build_all.sh script found in the same directory as camshiftdemo.c. All I got is a Could not initialize capturing... message. Then I tried to build it with this line (found it after building the demo with CMake in the building directory that CMake create...

is anybody doing anything about 2038 time_t bug?

Possible Duplicate: What should we do to prepare for 2038? I don't mean 'people' in the abstract. I mean are you doing anything and if so what? I am an ancient programmer and recall when I wrote COBOL in the late 70's saying to others in my team "you know - this isn't going to work in 2000". To which the reply was "yeah but t...

Unix C dup2 Question

I have a question regading dup2. What does it exactly do? Copies the File Descriptor? I don't quite understand the use of dup2. I tried google, and still don't quite understand what it means. Thank you in advance. ...

Unix C pipe Question

I'm trying to understand the usage of pipe. A parent process will pipe and if the parent forks, the child process will inherit the pipe. So now we hae a direct link to the child process and they can communicate? I get lost when we start to close pipes and redirect pipes. Does anyone have a good explanation on closing pipes and redirec...