General Initializers - General Initializers In C, usage...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
General Initializers In C, usage like: int f() {return 37;} int i = 47; int j; for global variables is legal. Typically, in an object file and an executable program these types of declarations might be lumped into sections with names like "text", "data", and "bss", meaning "program code", "data with an initializer", and "data with no initializer". When a program is loaded by the operating system for execution, a common scheme will have the text and data stored within the binary file on disk that represents the program, and the bss section simply stored as an entry in a symbol table and created and zeroed dynamically when the program is loaded. There are variations on this scheme, such as shared libraries, that are not our concern here. Rather, we want to discuss the workings of an extension that C++ makes to this scheme, namely general initializers for globals. For example, I can say: int f() {return 37;} int i = 47; int j = f() + i; In some simple cases a clever compiler can compute the value that should go into j,
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/27/2012 for the course CS 251 taught by Professor Staff during the Fall '08 term at Purdue University-West Lafayette.

Page1 / 2

General Initializers - General Initializers In C, usage...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online