c

How do I build libmySQL ?

I aim to integrate libmySQL into my executable instead of using libmySQL.dll. I use VC++ 2008 @ Windows Vista. I've downloaded "mysql-connector-c-noinstall-6.0.2-win32-vs2005.zip" from http://dev.mysql.com/downloads/connector/c/ It contains only ".h" files with declarations. Where is the implementation code (".c" files)? As said, I wi...

HAT-trie in ANSI C implementation?

Hello. I am looking for ANSI C HAT-trie implementation released under some free license. I have not found one. Can you point me to some standalone implementation or a program that uses HAT-tries to get at least slight idea how to implement it the roght way, please? The original paper on HAT-trie can be found here: http://crpit.com/conf...

How to create table (array) with extern values?

I would like to create a static (file scope) table of data pointer, data size and data version. The problem is that the data are in external files, but constants in the extern files. Example: file1.c const unsigned char data1[] = { 0x65, 0xF0, 0xA8, 0x5F, 0x5F, 0x5F, 0x5F, 0x31, 0x32, 0x2E, 0x31, 0xF1, 0x63, 0x4...

Calculate percentage of 64 int

I have the following code: typedef __int64 BIG_INT; typedef double CUT_TYPE; #define CUT_IT(amount, percent) (amount * percent) void main() { CUT_TYPE cut_percent = 1; BIG_INT bintOriginal = 0x1FFFFFFFFFFFFFF; BIG_INT bintAfter = CUT_IT(bintOriginal, cut_percent); } bintAfter's value after the calculation is 14411518807...

Werror ignore certain files

I am wondering if it is possible to have werror in gcc/g++ exclude certain files (ones that I do not have source code to modify) so that I can continue using werror in a uninhibited state. ...

How to avoid long chain of free's (or deletes) after every error check in C?

Suppose I write my code very defensively and always check the return types from all the functions that I call. So I go like: char* function() { char* mem = get_memory(100); // first allocation if (!mem) return NULL; struct binder* b = get_binder('regular binder'); // second allocation if (!b) { free(mem); ...

Static Variable Pointer?

Is this illegal/dangerous? int* static_nonew() { static int n = 5; return &n; } The compiler doesn't seem to have a problem with it, but is the pointer location itself protected from being overwritten when someone else needs memory? EDIT: A little bit more of an explanation of why I asked this question. Note: I'm programming ...

Compiler error when changing deprecated void _init() to use __attribute((constructor))

I decided it would be a fun side project to do some work on tsocks, since it hasn't seen any updates in 8 years. It's hosted here on GitHub. I only made cosmetic changes to the code so far, but now I've run into a compiler error. According to dlopen(3): The obsolete symbols _init() and _fini() [...] Using these routines [...] is not r...

What is the simplest way of implementing bigint in C?

Hi, I am trying to calculate 100! I am looking for the simplest way to accomplish this using C. I have read around but have not found a concrete answer. If you must know, I program in Xcode in Mac os X. Thanks! ...

Good example of using libpurple?

I have an old machine in my house and one of the things this machine does is detect whether a particular door in the house has just opened or closed. Right now, I have that machine post a tweet on a private Twitter account. I would now like to give this machine its own AIM account and have it send me a message on AIM. The only message...

how can i create a DLL of a program written in c program..?

how can i create a DLL of a program written in c program..?(am using turbo c compiler) the same program i could use with c# or VB program as- DLL reference.. http://support.microsoft.com/kb/106553 check out this link(i didn't understand this..) ...

Why do C programmers use typedefs to rename basic types?

So I'm far from an expert on C, but something's been bugging me about code I've been reading for a long time: can someone explain to me why C(++) programmers use typedefs to rename simple types? I understand why you would use them for structs, but what exactly is the reason for declarations I see like typedef unsigned char uch; typedef ...

Prototyping a filesystem

What are some best practises for prototyping a filesystem? I've had an attempt in Python using fusepy, and now I'm curious: In the long run, should any respectable filesystem implementation be in C? Will not being in C hamper portability, or eventually cause performance issues? Are there other implementations like FUSE? Evidently c...

#pragma inside #define

I'm working in a micro controller using C language. In this specific micro, the interrupts have to be defined using #pragma in following way: static void func(); #pragma INTERRUPT func <interrupt_address> <interrupt_category> static void func() { /* function body */ } The <interrupt_address> is address of the interrupt in vector table...

C1x: When will it land, what to expect?

C99 still isn't supported by many compilers, and much of the focus is now on C++, and its upcoming standard C++1x. I'm curious as to what C will "get" in its next standard, when it will get it, and how it will keep C competitive. C and C++ are known to feed on one another's improvements, will C be feeding on the C++1x standard? What ca...

Are there any alternatives to C?

C++ is often touted as the evolution of C, which it is not. To draw an analogy for the kind of language I'm looking for: {Perl, Python, Ruby, Groovy} {C++, D} {Java, C#} {C, Fortran, Modula-2?, Pascal?, Go?} Do any proposed, or implemented languages fit in the same (enormous) niche as C, with the intention of being an alternative, wh...

32x32 Multiply and add optimization

Hi, I'm working on optimizing an application . I found that i need to optimize an inner loop for improved performance. rgiFilter is a 16 bit arrary. for (i = 0; i < iLen; i++) { iPredErr = (I32)*rgiResidue; rgiFilter = rgiFilterBuf; rgiPrevVal = rgiPrevValRdBuf + iRecent; rgiUpdate = rgiUpdateRdBuf + iRecent; iPre...

Passing command line arguments to different parts of my program in ANSI C

I have tried to read up on the subject but when I try to run what I thought would be the correct thing it doesn't do what I want it to :) I have a main program, that should take three mandatory arguments, let's call them t, p and s. Then I have several modules that, as a part of their initialization, also rely on command line arguments....

system command hanged in C program, but when I run the command on bash it is successfull.

Hi All, I need to send the arp of a IP to get it's mac address which is configured on different machine. I am arping this ip from a C program by "system(arping -c 3 -i eth0 ) but I see that this is hanged in there. But if I run the same command from bash "arping -c 3 -i eth0 " it get executed successfully. I could not understand why ...

GTK: positioning context menu items w.r.t context menu

I am working on a defect in my GTK code for displaying context menus. After creating a menu with a number of menu items, I use gtk_menu_popup() to display the menu. This function takes a function pointer of type GtkMenuPositionFunc which lets me position the menu. I don't really do anything here except tell GTK to keep current position b...