c

What is the purpose of the ## operator in C++, and what is it called?

I was looking through the DXUTCore project that comes with the DirectX March 2009 SDK, and noticed that instead of making normal accessor methods, they used macros to create the generic accessors, similar to the following: #define GET_ACCESSOR( x, y ) inline x Get##y() { DXUTLock l; return m_state.m_##y;}; ... GET_ACCESSOR( WCHAR*, W...

I need some new blogs to help learn my new language (it's C).

I'm a BIG blog reader. I can't stop reading blogs. Blogs helped me find this site (in particular Jeff's blog). However I've come to realize that all the blogs I read deal with one language. Coding Horror Fabulous Adventures In Coding Jon Skeet's Blog Scott Hanselman's Blog Did you guess the language? Well now I'm learning C and usi...

Build system choice?

I am currently setting up a new software project and I want to have an automated build system. The project has a fairly complex involving C, C#. It must also generate automatic bindings (Python, PHP, Java, Ruby, etc.) using an external tool (SWIG). The project should be able to built, and run in Linux, Windows, and possibly Mac OS X. I...

What's does ... mean in an argument list in C ?

I came across the following function signature and I wondered if this (the ellipsis, or "...") is some kind of polymorphism? #include <fcntl.h> int fcntl(int fd, int cmd, ... ); Thanks in advance. ...

Getting List of Static Libraries used in an executable

Since ldd lists only the dynamic libraries. Is there a way to extract the info. about static libraries used to create the executable ? TIA, Saurabh ...

Is this a bug in GMP 4.1.2 or is it something I'm doing wrong?

To this bit of code I pass the string "kellogs special k" and I get 1 which means that the string is an integer. What on earth am I doing wrong? Or is it a GMP problem? #define F(x) mpf_t (x); mpf_init( (x) ); long __stdcall FBIGISINTEGER(BSTR p1) { USES_CONVERSION; F(n1); LPSTR sNum1 = W2A( p1 ); mpf_set_str( n1, sNum1, 10 ); re...

embedding absolute path for shared libraries

Using a vendor provided cross-compiling toolchain (apparently an OpenEmbedded derivative), I'm unable to embed the absolute path to third-party (open source, compiled in house)libraries. With the following gcc command line: arm-linux-gcc test_connect_send.o gprs_connect.o \ /package/host/myvendor.com/API-R-2.0.0/Release/Libraries/li...

Memory allocators

I want to make a virtual allocator using c++ on windows,, which allocate data on a file on the hard disk, to reduce physical memory usage when allocate large objects !.. I don't want to use system virtual memory with virtualAlloc.. . I want to create a file on the disk and use it to allocate the whole objects and then move the part or th...

How to do an active sleep?

I am running some profiling tests, and usleep is an useful function. But while my program is sleeping, this time does not appear in the profile. eg. if I have a function as : void f1() { for (i = 0; i < 1000; i++) usleep(1000); } With profile tools as gprof, f1 does not seems to consume any time. What I am looking is a ...

getting the HWND for my own application in C

since I couldn't find an answer to this question I researched a bit further into the MSDN and I found isChild(). It might give me the answer to that other question. Now, in order to use isChild() I need to pass the HWND of the parent application that I want to check, in this case my own application. How do I get the HWND of my own appli...

how to return an script in c / gcc?

guys, had been years since I wrote my last line in C, now I'm trying to start again to make some function and use than as an extension for php. this is an easy function to create "small urls" lets say: a0bg a0bf a0bh the problem I'm having is when I have to "increment" an string like zzz then I got: Bus Error otherwise if I increme...

Recomended in-depth winsock literature?

Most winsock tutorials on the net are preety much basic, and become useless once you got some more serious questions as to the internals of the system. MSDN is somewhat more inshightful, but tends to be preety minimalistic and sometimes ambigious. Can you recommend some good reading materials, books or articles, that really cover the su...

using unix domain socket and sharing fd's

Hello All, Not been able to figure out why recvmsg() blocks when i try this test app on ubuntu. http://web.mit.edu/kolya/misc/break-chroot.c thanks ...

How to store a value of NSString as char array within a structure in Objective-C?

I am having trouble assigning the value of an NSString to a char * within a structure of a singleton class. The following is a simplification of my problem. My code utilizes more fields in the structure and passes more NSStrings. Say I have a singleton class "SingletonClass" with a structure (I've done my homework with the Apple Documen...

What is the Cost of an L1 Cache Miss?

Edit: For reference purposes (if anyone stumbles across this question), Igor Ostrovsky wrote a great post about cache misses. It discusses several different issues and shows example numbers. End Edit I did some testing <long story goes here> and am wondering if a performance difference is due to memory cache misses. The following cod...

How to get network adapter stats in linux/Mac OSX?

I'm looking for a way to get hold of network stats in C on Linux and MacOSX. Specifically, I need to monitor the number of bytes uploaded and downloaded from each network adapter on the system - I don't need to do packet inspection, or differentiate between protocols, just a 'total bytes' counter which I can poll at intervals would be fi...

source code of c/c++ functions

Hello, I wanted to have a look at the implementation of different C/C++ functions (like strcpy, stcmp, strstr). This will help me in knowing good coding practices in c/c++. Could you let me know where can I find it? Thanks. ...

Why are some functions extremely long? (ideas needed for an academic research!)

Hi, I am writing a small academic research project about extremely long functions. Obviously, I am not looking for examples for bad programming, but for examples of 100, 200 and 600 lines long functions which makes sense. I will be investigating the Linux kernel source using a script written for a Master's degree written in the Hebrew ...

Looking for advanced C programming book

I need a book that deals with implementing real projects in C, in contrast to "C Programming Language" which I recently finished reading and mastered, that only teaches the language. Something that deals with advanced topics such as: how to organize the source files, how to organize headers, more advanced preprocessing directive like #if...

How might I perform DNS lookups using C/C++ on Linux?

How do I get similar functionality to the host command using a c api (or any other language for that matter)? I need more information than just an IP address given by gethostbyname(); specifically, the SMTP-related data. ...