August 19, 2011
Profiling tools for Linux
http://valgrind.org/
http://www.cs.utah.edu/dept/old/texinfo/as/gprof_toc.html
http://oprofile.sourceforge.net/about/
http://perfinsp.sourceforge.net/#Overview
Guide to porting from Solaris to Linux on x86
Solaris is considered one of the closest flavors of UNIX® to Linux™, but for migration purposes, there can be differences between the two in the areas of memory mapping, threading, or natural language support (to name just a few). This porting guide gives you advice on planning for the port to Linux/x86, and helps you understand the differences in the development environment and architecture.
June 16, 2011
STL containers
• deque
• hash_map
• hash_multimap
• hash_multiset
• hash_set
• list
• map
• multimap
• multiset
• set
• vector
Sequence containers are: vector deque list
Associative containers are: set multiset map and multimap.
Containers adapters: stack queue and priority_queue.
No hash containers are defined in the current C++ STL standard. However other STL implementation might have some hash based containers (ie STL SGI implementation).
The primary idea in the STL is the container (also known as a collection), which is just what it sounds like: a place to hold things. You need containers because objects are constantly marching in and out of your program and there must be someplace to put them while they’re around. You can’t make named local objects because in a typical program you don’t know How many, or what type, or the lifetime of the objects you’re working with. So you need a container that will expand whenever necessary to fill your needs. All the containers in the STL hold objects and expand themselves. In addition, they hold your objects in a particular way.
A vector is a linear sequence that allows rapid random access to its elements. However, it’s expensive to insert an element in the middle of the sequence, and is also expensive when it allocates additional storage. A deque is also a linear sequence, and it allows random access that’s nearly as fast as vector, but it’s significantly faster when it needs to allocate new storage, and you can easily add new elements at either end (vector only allows the addition of elements at its tail). A list the third type of basic linear sequence, but it’s expensive to move around randomly and cheap to insert an element in the middle. Thus list, deque and vector are very similar in their basic functionality (they all hold linear sequences), but different in the cost of their activities. So for your first shot at a program, you could choose any one, and only experiment with the others if you’re tuning for efficiency.
All three have a member function push_back( ) which you use to insert a new element at the back of the sequence (deque and list also have push_front( )).
An iterator is a class that abstracts the process of moving through a sequence. It allows you to select each element of a sequence without knowing the underlying structure of that sequence.This is a powerful feature, partly because it allows us to learn a single interface that works with all containers, and partly because it allows containers to be used interchangeably.
class Shape {
public:
virtual void draw() = 0;
virtual ~Shape() {};
};
class Circle : public Shape {
public:
void draw() { cout << "Circle::draw\n"; }
~Circle() { cout << "~Circle\n"; }
};
class Triangle : public Shape {
public:
void draw() { cout << "Triangle::draw\n"; }
~Triangle() { cout << "~Triangle\n"; }
};
class Square : public Shape {
public:
void draw() { cout << "Square::draw\n"; }
~Square() { cout << "~Square\n"; }
};
typedef std::vector
typedef Container::iterator Iter;
int main() {
Container shapes;
shapes.push_back(new Circle);
shapes.push_back(new Square);
shapes.push_back(new Triangle);
for(Iter i = shapes.begin();
i != shapes.end(); i++)
(*i)->draw();
// ... Sometime later:
for(Iter j = shapes.begin();
j != shapes.end(); j++)
delete *j;
} ///:~
November 15, 2009
Interview questions
CmdTraget Class in MFC
SendMessage and Post Message in MFC
CObject Class in MFC
Can we use Free with new or delete with Malloc ?
how to define const data type in C++ class
CArchive Class in MFC
which is the Base of all MFC classes?
blocking function in socket
How to define or declare static in class
safe array
smart pointer
November 14, 2009
Unit testing native (C/C++) code on Windows
November 13, 2009
September 16, 2009
Detecting memory leaks in C++
http://www.research.att.com/~bs/bs_faq2.html#memory-leaks
http://www.boost.org/doc/libs/1_40_0/libs/smart_ptr/smart_ptr.htm
http://www.hpl.hp.com/personal/Hans_Boehm/gc/
http://www.flipcode.com/archives/Presenting_A_Memory_Manager.shtml
http://duma.sourceforge.net/
http://www.andreasen.org/LeakTracer/
http://perens.com/FreeSoftware/ElectricFence/
http://valgrind.org/
May 4, 2009
Free and Open Source Software Portal
March 5, 2009
February 17, 2009
Web services in C++
Try gSOAP toolkit.
http://www.cs.fsu.edu/~engelen/soap.html
http://gsoap2.sourceforge.net
Visual Memory Leak Detector
http://www.codeproject.com/KB/applications/visualleakdetector.aspx
Free SSL/TLS toolkit
"The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a full-strength general purpose cryptography library. "
December 4, 2008
October 14, 2008
Interview Questions
2)Features of OOPS
3)Initilizaion List in C++
4)Types of Constructors
5)return type of constructor
6)copy constructor and assignment opertrator
7)Explicit constructor
8)Mutable keyword
9)Use of extern
10)Casting Dynamic cast and static cast
11)difference in mutable and static cast
12)Type of overloading
13)Virtual function
14)use of VTable
15)Abstract Class
16)destructor be virtual?
17)volatile qualifier
18) SafeArrays
19)Object Slicing
20)Polymorphic class
21)A persistent varible
22) Size of class with declaration of virtual function and without declaration of any function
23) #Pragma
24)Inline and Macro
=============================
STL
Vectors
List
Deque
Sets
MAp
Dynamic Function with Argument like printf
What is the difference between a ‘thread’ and a ‘process’?
How to prevent memory leaks
=================================
Two processes can share memory in a number of ways.
1. Memory-mapped files
2. Shared memory segments
3. Message queues
4. Named pipes
what is OSI model and Layer of Model
IPC mechanisms are supported by Windows:
Clipboard ,COM ,Data Copy ,DDE ,File Mapping ,Mailslots ,Pipes ,RPC ,Windows Sockets .
type of pipes
type of socket
type of protocol
version of protocol
method in client side and method of server side
what is COM and DCOM
basic method of COM
WMI Process
====================================================================================
MFC
what do mean by AFX
Model and modelless dialog how to create
Document/View Articture
difference between DDE/DDX
September 17, 2008
Debug v/s Release mode
Follow these rules:
Rule 1: Always regularly test both the Debug and Release mode versions of your applications.
Rule 2: Never classify a problem as a Debug -Vs- Release mode problem unless you've tried both versions on several different machines.
Rule 3: Be very cautious that you dont place code that must be executed in a place where it will be compiled out in release mode.
Rule 4: Never assume that your variables are initialized unless you've explicitly initialized them in your code. This includes global variables, automatic variables, malloced data, and newed data.
Rule 5: When you start a project turn the warning level to "Level 3" or "Level 4" and make sure your code compiles with no warnings before you check your code in.
Rule 6: Make sure all references to resources are removed when you delete them from your resource file. This includes references in resource.h.
http://www.codeguru.com/cpp/v-s/debug/article.php/c1259/
http://www.codeproject.com/KB/debug/survivereleasever.aspx
http://www.codeproject.com/KB/debug/releasemode.aspx
September 8, 2008
July 30, 2008
C++ References
C++ reference: http://www.cppreference.com/
Other language references: http://www.cppreference.com/links.html
Eclipse C/C++ Development Tooling - CDT
Take a look,
http://www.eclipse.org/cdt/
July 28, 2008
10 Commandments for C Programming
(Dated but still relevant advice on C Programming)
http://cplus.about.com/od/learningc/a/10-commandments.htm