Saturday, February 28, 2009

C++ -- Standard Template Library

Vector:
1. In addition to operator [], vector defines the member function at() that checks the index. If the index is invalid, it will throw an object of class std::out_of_range. Code: 09Feb/feb28_1.cpp.
2. The assign() function will reinitialize vector. e.g., vec.assign(v0.begin(), v0.end()) or vec.assign(5,"Me")

Allocators:

Memory Management

Memory Management:
The Memory Management Reference
Memory management in various languages at The Memory Management Reference

Garbage Collection:
Garbage collection - Wiki
C++ Memory Management Innovation: GC allocator - from codeproject

A Garbage collector for C and C++
Garbage Collection in C++ - from Stackflow
Garbage Collection in C programs - Linux Journal
Automatic Garbage Collection in Java and C++
A Simple Garbage Collector for C++

C++ Standard Library Allocator:
C++ Standard Allocator, An Introduction and Implementation
A C++ Standard Allocator for the Standard Template Library
The Standard Librarian: What Are Allocators Good For?

User-Defined Allocator - For Nicolai M.Josuttis

Articles:
Memory management archive collection from open directory projects
Freestore management on C++ FAQ Lite
Unix and C/C++ Runtime Memory Management For Programmers
Inside Memory Management

LinuxMM: a wiki for documenting how memory works and for coordination new memory management development projects.

Code Refactoring

Code Refactoring - Wiki
Refactoring Homepage

Friday, February 27, 2009

C++ Memory Management

C++ Memory Management - From Fear to Triumph
1. Alternatives have automated memory management. Python has reference-counted model, and Java has sophisticated garbage collector.
2. Memory errors come in two basic types: the dangling reference and the memory leak.
3. The hidden memory allocation inside classes is a side effect, we need consider available alternatives.
[1] Allow the user to supply her own buffer (e.g., as a parameter to the constructor)
[2] Use a member object instead of a pointer to a dynamically allocated object.
[3] Strictly local objects that are used only for the duration of a method call should be declared as automatic variables.
[4] Use an allocator object to get the memory, and allow the user to specify his owner allocator.
4. Techniques for C++ Memory Management
5. Return value optimization.
SimpleString return_by_value() {
// Constructing the return value helps to eliminate the temporary objects associated with return-by-value
return SimpleString("ReturnValueOptimization");
}

From: http://www.linuxdevcenter.com/pub/a/linux/2003/05/08/cpp_mm-1.html?page=1

Difference between malloc/free and new/delete
[1] malloc() allocates a bunch of bytes while 'new' does the allocation as well as the responsibility of calling the constructor.
[2] malloc() returns 'NULL' on failure while 'new' throws an exception object of type 'std::bad_alloc'.
[3] 'free()' on 'NULL' pointers is not safe while 'delete' is.

GCC - Compiling a C++ program

C++ compilation options:
-Wall and -W: When compiling with g++, the options -Wall and -w include extra warnings specific to C++ (the warnings relate to member functions and virtual classes).
-fno-default-inline: disables the default inlining of member functions defined in the bodies of C++ classes. Select this option if you prefer to control inlining yourself, or want to set a breakpoint on member functions that would otherwise be inlined.
-Wold-style-cast: highlights any uses of C-style casts in C++ programs.

Templates:
[1] The executables created by g++ using the C++ standard library will be linked to the shared library 'libstdc++', which is supplied as part of the default GCC installation. There are several versions of this library -- if you distribute executables using the C++ standard library you need to ensure that the recipient has a compatible version of 'libstdc++', or link your program statically using the command-line option -static.
[2] The recommended way to use templates with g++ is to follow the inclusion compilation model, where template definitions are placed in header files. This is the method used by the C++ standard library supplied with GCC itself. If a template function is used several times in a program it will be stored in more than one objet file. The GNU Linker ensures that only one copy is placed in the final executable.
[3] Explicite template instantiation: template functions are no longer compiled at the point where they are used, as a result of the -fno-implicit-templates option.

Goto: http://www.network-theory.co.uk/docs/gccintro/gccintro_53.html

Thursday, February 19, 2009

Linux-C/C++

Learning C++ With Linux: an achive from Linux journal, suitable for newbie.
Linux C++ Software Development - from yolinux.com: links to Linux C++ GUI frameworks, APIs, IDEs, as well as C++ tips for Linux developers.

C/C++ Community

devx - C++ zone

Design Pattern

Design patterns were originally grouped into the categories Creational patterns, Structural patterns, and Behavioral patterns, and described them using the concepts of delegation, aggregation, and consultation.

Wiki:
Design Pattern - wiki
Singleton pattern - wiki

General:
C++ Design Pattern: What is a Design Pattern (CodeGuru)
Design Patterns

Tuesday, February 17, 2009

Programmer's Homepage

Export level:
Bjarne Stroustrup: C++'s father
John K. Ousterhout: invertor of Tcl language
Stan Lippman's Blog: autho of "C++ Primer"

Author level:
Steve McConnell's Homepage: author of "Code Complete"
Scott Meyers: author of Effective C++
Herb Sutter: author of Exceptional C++
Andrei Alexandrescu: author of "C++ Coding Standards" & "Modern C++ Design"
Nicolai M.Josuttis: author of "The C++ Standard Library"

Industry Guru level:
Joel on Software
John Graham-Cumming: create open source POPFile email filtering program
Maciej Sobczak: from Switzerland who are master on C++ and Tcl programming.
Brad Appleton's Home Page : a software development specialist.
David A. Wheel
Programmer's Corner@tmh: some c++ and perl resources
The Cantrip Corpus: in the ISO/ANSI C++ Standard committee
Pete Isensee: lots of C++ related papers and presentations
Kegel Homepage: lots of programming, IT suff

Industry Technical Level:
Shlomi Fish's Homepage

Academic:
Douglas C. Schmidt: CS professor, have some good material about C++/OOP
Cliff Green: a repository for programming teaching materials and technical articles

Techinical Blog:
Beans
Deepen C++ - blogspot
Yonat Sharon
C++ Soup

Fave Links

Fred Swartz;

EDA Opensource Software

OpenAccess:
OpenAccess Wiki
OpenAccess Gear
OpenAccess Gear Project Page
OpenEDA.org
Si2.org OpenAccess

SAT Solving:
SAT solving - a mini course
MiniSAT
Boolean Satisfiability Research Group at Princeton
SATLib

EDA Website

EE Times Deepchip

Semiconductor

International Technology Roadmap for semiconductors

Manufacturing:
Lithography: www.lithoguru.com

EDA Research Group

EDA Industry Working Groups

Industry:
IBM Design Automation

FPGA:
FPGA Research at University of Toronto
Jonathan Rose; Vaughn Betz;
FPGA Research at UCLA VLSI CAD Laboratory

Electronic Design Automation:
UC Berkeley - Design of Electrical System

VLSI CAD Courses Collection

VLSI Design Flow:
Design Flow - From U-Mass

VLSI Design Courses:
Project Based Material for Teaching VLSI Design and Fabrication
ASCI Design
Integrated System Design
Design of VLSI System
VLSI Design Principles
CS250 VLSI System Design - from UC Berkeley

General:
CAD for Digital Circuit Synthesis and Layout - from Prof. Jason Anderson@UT
ECE556 VLSI Physical and Logic Design Automation - from Sunysb
ECE565 VLSI Design Automation - from UIC
EECS 244 Introduction to Computer-Aided Design - from UCBerkeley

Physical
VLSI Physical Design Automation - from Prof. David Z. Pan@UTAustin
Introduction to VLSI CAD - from Northwest University

Logic:
Logic Synthesis and Verification EECS219B@UC Berkeley
Introduction to Logic Synthesis - from Adnan Aziz@UTAustin
ECE459 VLSI Algorithms - from Northwest
Advanced Methods in Logic Synthesis and Equivalence Checking - from Prof. Alan Mishchenko@Berkeley
Sequential Logic Synthesis and Verification - from Prof. Alan Mishchenko@Berkeley
Logic Synthesis for Hardware System - from Robert Brayton@Berkeley

VLSI Tools:
VLSI CAD Tools setup and tutorials
EDA Tools for Introductory VLSI Design Courses

Blogs

Chinese blogs:
编程随想