Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 C


  Do you really understand C? 21st International Obfuscated C Code Contest winning entries

The 21st International Obfuscated C Code Contest(IOCCC) officially launched the winning source code. IOCCC requires contestants to write the most creative and the most obfuscated C codes with the size limited to 4kb and less Work of each participant is impressive. The winners, including one French, one Korean, five Americans, one Belgian, one Israeli, one British, four Japanese and one Chinese.Here we list some codes:Best short programSeonghoon Kang  from Korea- Decodes spelled out numberslong long n,u,m,b;main(e,r)char **r;{f\or(;n++||(e=getchar()|32)>=0;b="ynwtsflrabg"[n%=11]-e?...

11,592 0       C OBSFUCATION CONTEST


  gethostbyname vs getaddrinfo

getaddrinfo is slower than ping when resolving domain names. I think ping uses gethostbyname to resolve a domain name. The question becomes whether getaddrinfo is slower than gethostbyname. After testing with both functions, we find that getaddrinfo is really slow compared to gethostbyname. By strace tracking,  we find getaddrinfo will communicate with DNS server 10 times and gethostbyname will communicate with DNS server communication twice.gethostbyname is an old way to resolve domain name, The disadvantage of it is that it does not support IPV6, so there is a gethostbyname2 which repla...

20,477 0       C++ NETWORK DNS


  Books for entry level C programmers

In computing, C is a general-purpose programming language initially developed by Dennis Ritchie between 1969 and 1973 at Bell Labs Its design provides constructs that map efficiently to typical machine instructions, and therefore it found lasting use in applications that had formerly been coded in assembly language, most notably system software like the Unix computer operating system.To learn C, we need to read many C books and have many practices. Here we summarize a list of C books which may help you learn C.1. How to Think Like a Computer Scientist :C versionAlthough it contains only basic ...

8,799 0       C BOOK BEGINNING


  C Macro Tips and Tricks

Preprocessor vs CompilerTo properly understand C macros, you must understand how a C program is compiled. In particular, you must understand the different things that happen in the preprocessor and in the compiler.The preprocessor runs first, as the name implies. It performs some simple textual manipulations, such as:Stripping comments. Resolving #include directives and replacing them with the contents of the included file. Evaluating #if and #ifdef directives. Evaluating #defines. Expading the macros found in the rest of the code according to those #defines.It is, of course, these...

18,286 0       C MACRO PREPROCESSOR TRICK


  Error handling style in C

Following are three error handling styles in C.Which one you like the most? Or you don't like any one?1. /* Problem : Not enough. Easy to be wrong */int foo(int bar){        int return_value = 0;        int doing_okay = 1;        doing_okay = do_something( bar );        if (doing_okay)        {                doing_oka...

19,733 13       C ERROR HANDLING STYLE GOTO NESTED IF


  The most stupid C bug ever

I have been programming for a number of years already. I have seen others introduce bugs, and I have also introduced (and solved!) many bugs while coding. Off-by-one, buffer-overflow, treating pointers as pointees, different behaviors or the same function (this is specially true for cross-platform applications), race conditions, deadlocks, threading issues. I think I have seen quite a few of the typical issues.Yet recently I lost a lot of time to what I would call the most stupid C bug in my career so far, and probably ever.I am porting a Unix-only application which uses tmpfile() to create te...

2,507 0       C BUG COMMENT BACK SLASH


  TIOBE : C overtakes Java as the No.1 programming language

TIOBE has released the Programming Community Index for April 2012. The highlight of this month is that C overtakes Java as the No.1 programming language again. C language is liked by more and more developers of all ages. Due to the growing popularity of the Android platform, Java decline will not be obvious. Previously Java took a very long time to overtake C, now C once again returns to the throne. The battle between these two languages will continue.The top three are respectively, C, Java and C + +. Objective-C continues to heat up, while C# drops to No.5.Other interesting moves this m...

155,031 4       JAVA C.TIOBE


  Faster than C

Judging the performance of programming languages,usually C is called the leader,though Fortran is often faster.New programming languages commonly use C as their referenceand they are really proud to be only so much slower than C.Few language designer try to beat C.What does it take for a language to be faster than C?Better Aliasing InformationAliasing describes the fact that two references might point to the same memory location.For example, consider the canonical memory copy:void* memcopy(void* dst, const void* src, size_t count) { while (count--) *dst++ = *src++; return dst;}Depending on...

3,263 1       C PERFORMANCE SPEED FORTRAN CRITERIA