RSS
people

Top 20 C++ tips

The following tips are a collection of general hands-on techniques and recondite pieces of knowledge not associated with a specific platform, programming domain, or compiler. As such, they can be of use to all C++ programmers. I grouped the tips into five major categories: general guidelines for coding style, memory management, performance enhancement, object-oriented design, and the Standard Template Library (STL).

What makes these tips special is that the information they provide usually cannot be found in C++ books or Web sites. For example, pointers to members are one of the most evasive, tricky, and bug-prone issues for even advanced users.…

Continue reading about Top 20 C++ tips

No Comments |

C++ Code Optimization

C++ Optimizations

These optimizations are fairly easy to apply to existing code and in some cases can result in big speedups. Remember the all-important maxim though, the fastest code is code that isn’t called.
Use Initialization Lists

Always use initialization lists in constructors. For example, use

TMyClass::TMyClass(const TData &data) : m_Data(data)
{
}

rather than

TMyClass::TMyClass(const TData &data)
{
m_Data = data;
}

Without initialization lists, the variable’s default constructor is invoked behind-the-scenes prior to the class’s constructor, then its assignment operator is invoked. With initialization lists, only the copy constructor is invoked.
Optimize For Loops

Whereever possible, count down to zero rather than up to n. For example, use

for (i = n-1; i…

Continue reading about C++ Code Optimization

1 Comment |

Obfuscated C Code Tricks

1. Introduction

Hello there dear claimant C obfuscator!You’re here so that I can teach you the fine art of obfuscation, thaught by the Tao since the Beginning. Not obfuscation for professional purposes though – it’s recreational obfuscation, possibly used to enter obfuscation contests, but mostly for when you’re bored and your girlfriend or similar entertainment been is away.

Nevertheless, you will learn some nice “features” of C and maybe you can even make use of some of the tricks with legitimate purposes in our daily coding. You, however, have the prime objective of having fun while reading this article.

Requirements? C knowledge, a…

Continue reading about Obfuscated C Code Tricks

No Comments |

Where can I find C standards documents to download?

Below are the links to different C standard documents:

Note: ISO/IEC 9899:1999 is the current standard for C language. The n869 is the draft prepared for the current standard, so it may not contain accurate information. C89 (also called as C90) is the most widely supported standard by compilers, not many compilers have complete support the C99 standard.

Continue reading about Where can I find C standards documents to download?

No Comments |

Most obfuscated code to print india map

Check this program really cool !!!!

india.png

 

program :

#include
#include
main()
{
int a,b,c;
int count = 1;
for (b=c=10;a="- FIGURE?, UMKC,XYZHello Folks,\
TFy!QJu ROo TNn(ROo)SLq SLq ULo+\
UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\
NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\
HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\
T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\
Hq!WFs XDt!" [b+++21]; )
for(; a-- > 64 ; )
putchar ( ++c=='Z' ? c = c/ 9:33^b&1);
}

Continue reading about Most obfuscated code to print india map

No Comments |

Program Without main() function !

program without main() !!

#include
#include
#define e1(s,t,u,m,p,e,d) m##s##u##t
#define begin e1(a,n,i,m,a,t,e)
begin()
{
printf("Muthu ");
}

One clue , main is called indirectly !! Got it ????

Continue reading about Program Without main() function !

No Comments |

sizeof()

Well found something new about the sizeof()

firstly it is an unary operator and shouldn’t be mistaken for a function

secondaly, what do you expect the output of

int i=10;
j=sizeof(i++);
printf("%d, %d",i,j);

well the value of i doesn’t get incremented as sizeof is a compile time operator and produces a compile-time integer constant value. The expession inside sizeof() is only expected to deduce its type and is not fully evaluated…. should have known this though!!!!

also found a new thing today…. sizeof(’x’) returns 2 or 4 but not 1. This is because by definition, in C, character constants are integers and not characters!!!! I…

Continue reading about sizeof()

No Comments |