In C or C++, is there a way to extend a class without inheritance?
Is there a way to implement functionality like Class Categories (of Objective-C) or Extension Methods (of C# 3.0) in C and/or C++? ...
Is there a way to implement functionality like Class Categories (of Objective-C) or Extension Methods (of C# 3.0) in C and/or C++? ...
I am porting some legacy code from windows to Linux (Ubuntu Karmic to be precise). I have come across a Win32 function GetDateFormat(). The statements I need to port over are called like this: GetDateFormat(LOCALE_USER_DEFAULT, 0, &datetime, "MMMM", 'January', 31); OR GetDateFormat(LOCALE_USER_DEFAULT, 0, &datetime, "MMMM", 'May', 3...
Assume the following: Elf_Section_Header *sectionHeaderTable //points to the start of a ELF section header table Elf_Section_Header *symtabHeader //points to the start of the symtab section header Why doesn't the following point me to the associated string table section header? Elf_Section_Header *strTabSectionHeader = (Elf_Section_...
Hi, I'm a student with a bit of experience in Java and C++ (one semester each) Currently, I'm going through K&R and working on the exercises in the book. However, I was thinking of what I could work on over the summer since I'm almost done with K&R and I will have a lot of free time soon. I really like building command line applicatio...
Here's what I take to be a pretty standard header for a list. Because the struct points to itself, we need this two-part declaration. Call it listicle.h: typedef struct _listicle listicle; struct _listicle{ int i; listicle *next; }; I'm trying to get swig to wrap this, so that the Python user can make use of the listicle ...
So basically, I need to know if there is an iPhone C compiler that can be installed on the iPhone... Then I would like to know what parameter I would put in the system("compile Foo") function. Thanks for the help in advanced. ...
Hi all. I'm trying to analyze core dump, but i get following result. If i make main.elf statically linked everything is OK and i can see bt of all threads. Any ideas? GNU gdb 6.6.0.20070423-cvs Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to chang...
Hi, I came to know that JRE /JVM was not built using Java. The Sun JRE was built in C and IBM JRE was built in SmallTalk (First Object Oriented Language). Pleas help me with answer. Thanks in advance. ...
I want to make this clear up front : I know how this trick works, what I want is a link to a clear explanation to share with others. One of the answers to a C macro question talks about the "X macro" or "not yet defined macro" idiom. This involves defining something like: #define MAGIC_LIST \ X(name_1, default_1) \ X(name_2, de...
I have a file of data Dump, in with different timestamped data available, I get the time from timestamp and sleep my c thread for that time. But the problem is that The actual time difference is 10 second and the data which I receive at the receiving end is almost 14, 15 second delay. I am using window OS. Kindly guide me. Sorry for my...
I am getting the following warning when compiling some legacy C code on Ubuntu Karmic, using gcc 4.4.1 The warning is: src/filename.c:385: warning: '0' flag ignored with precision and ‘%i’ gnu_printf format The snippet which causes the warning to be emitted is: char buffer[256] ; long fnum ; /* some initialization ...
does ansi c allows serial communication on rs232 null modem? if yes then any one give me example? thanx in advance ...
I have an SHA1 hash and I need to sign it. The CryptSignHash() method requires a HCRYPTHASH handle for signing. I create it and as I have the actual hash value already then set it: CryptCreateHash(cryptoProvider, CALG_SHA1, 0, 0, &hash); CryptSetHashParam(hash, HP_HASHVAL, hashBytes, 0); The hashBytes is an array of 20 bytes. However...
I have 3 processes which need to be synchronized. Process one does something then wakes process two and sleeps, which does something then wakes process three and sleeps, which does something and wakes process one and sleeps. The whole loop is timed to run around 25hz (caused by an external sync into process one before it triggers proces...
Real simple question. According to my man-page, these two will do the same: time_t t; time(&t); printf("Time: %ld", t); ... printf("Time: %ld", time(NULL)); So, what exactly is the benefit of passing a pointer to time? In case time() would fail due to no clock being available, neither of the two variants will have any benefit in ...
Hi Experts, Is it possible to declare multiple static variables of same name in a single C file with different scopes? I wrote a simple programme to check this and in gcc it got compiled and worked fine. code: static int sVar = 44; void myPrint2() { printf("sVar = %d\n", sVar++); } void myPrint() { static int sVar =88; p...
Hi there, I'm wondering if there is an Objective C equivalent to .Net's BitConverter.GetBytes() method. For example, in C#, I can write something like this: byte[] lengthPrefix = BitConverter.GetBytes(message.length); What would the equivalent be in Objective C? Some example code would be greatly appreciated. Thanks in advance. ...
Hi, I know that nested functions are not part of the standard C, but since they're present in gcc (and the fact that gcc is the only compiler i care about), i tend to use them quite often. Is this a bad thing ? If so, could you show me some nasty examples ? What's the status of nested functions in gcc ? Are they going to be removed ? ...
I'm working on a fairly large project written in C. The idea was to build a library of modular blocks that can be reused across several platforms. Each module is associated with a word document in .docx format (huge pain to diff-merge). In these docs, an interface section is specified, listing datatypes and publicly accessible functions....
I just found this code on wikipedia. Link: http://en.wikipedia.org/wiki/Sizeof#Use The code: /* the following code illustrates the use of sizeof * with variables and expressions (no parentheses needed), * and with type names (parentheses needed) */ char c; printf("%zu,%zu", sizeof c, sizeof(int)); It states that: "The z prefix ...