BINDING TIMES…
BINDING TIMES
Binding என்பது ஒரு programming entity-க்கு ஒரு property / attribute-ஐ associate செய்வது. Simple Tamil: ஒரு name, variable, operator, function போன்றவற்றுக்கு அதற்கான meaning/type/memory/address போன்ற ஒன்றை connect செய்வதே Binding.
Binding என்பது ஒரு programming entity-க்கு ஒரு property / attribute-ஐ associate செய்வது. S……
int x = 10; இங்கு: x → int என்ற association உருவாகிறது. ……
1. BINDING என்றால் என்ன?…
Programming language-ல் பல associations இருக்கும். Examples: Variable name ↔ Data type Variable ↔ ……
SIMPLE EXAMPLE
int age = 25; இங்கு பல bindings இருக்கின்றன. age ↓ Identifier name age → int Type binding.……
BINDING TIME
ஒரு binding எப்போது establish செய்யப்படுகிறது என்பதே Bi……
BASIC FORMULA
Binding = Entity + Attribute associ……
int x; x-ன் type int என்று compiler தெரி……
1. WHY BINDING TIME IS IMPORT……
Binding early-ஆ அல்லது late-ஆ நடப்பது programming language-ன்: Flexibility Efficiency Safety Portability……
MAJOR BINDING TIMES
Programming language concepts……
Language Design Time
Language Implementation Time
Compile Time
Link Time
Load Time
Runtime
சில textbooks: Program Writing Time……
COMPLETE FLOW
Language Design ↓ Language Implementation ↓ Program Writing ↓……
LANGUAGE DESIGN TIME
Programming language create/design செய்யப்படும் நேரத்தில் சில lan……
LANGUAGE DESIGN TIME EXAMPLE
C++ language designers decide……
- means addition in suitable ……
if is a keyword while is a keyword int repres……
a + b…
- operator-ன் basic meaning l……
- means addition…
என்று ஒவ்வொரு program-லும் de……
KEYWORD BINDING
C++: while இந்த word ஒரு loop keyword என்று decide செய்யப்பட்டிருப்பது……
OPERATOR BINDING AT LANGUAGE DESIGN
a + b Basic + syntax and meaning……
- → multiplication…
/ → division % → remainder for integral operands இவை language design-level decisions……
LANGUAGE IMPLEMENTATION TIME
ஒரு programming language-க்கு compiler/interpreter/runtime implement செய்யும் போது……
IMPLEMENTATION TIME EXAMPLE
Data type size ஒரு classic example. C++ language standard சில ranges/……
sizeof(int) ஒரு implementation-ல் commonly: 4 bytes ஆக இருக்கலா……
IMPLEMENTATION TIME PROPERTIES
Examples: Representation of integer Floating-point implementation details Size/alignment choices w……
PROGRAM WRITING TIME
Programmer source code எழுதும் போது சில bindings explicitly select செய்கிறார். int mark; Programmer: mark → i……
ANOTHER PROGRAM WRITING EXAMPLE
double salary; Programmer decides: salary ……
COMPILE TIME BINDING
மிகவும் important.…
Compiler source program translate செய்யும……
COMPILE-TIME TYPE BINDING
int x = 10; Compiler knows: x → int Compile time-ல்……
STATIC BINDING
Compile time அல்லது execution-க்கு முன் fix ஆகும……
show() call எந்த non-virtual function-ஐ refer செய்கிறது ……
EARLY BINDING
Program execution ஆரம்பிக்கும் முன்பே association resolve செய்யப்பட்டால்: Early Binding……
COMPILE-TIME EXAMPLE - OVERLOADING
void print(int x) { cout…
OPERATOR OVERLOADING BINDING
a + b If a and b are integers:…
- → integer addition…
If user-defined class overloads +: obj1 + obj2 compiler s……
LINK TIME
Object modules மற்றும் libraries ஒன்றாக conn……
SIMPLE LINK TIME EXAMPLE
File 1: int add(int, int); int main() { return add(10,20); } File 2: int add(int a, int b) { return a + b; ……
EXTERNAL FUNCTION BINDING
sqrt() implementation math library-ல் இருக்கலாம். Linking……
LINKER ROLE
Object File + Library ↓ Linker ↓ Resolve externa……
LOAD TIME
Executable memory-க்கு load செய்யப்பட……
LOAD TIME ADDRESS BINDING
Executable disk-ல் இருக்கும்போது final physical memory position known இல்லாமல் இருக்கலாம். Loader:……
RELOCATION
Program memory-ல் load செய்யும்……
Program compiled address ↓ Loader ↓ Actual loaded address Address adjustment load time-ல் h……
DYNAMIC LIBRARY BINDING
Shared libraries: .dll .so பயன்படுத்தும் sys……
Executable ↓ Dynamic Loader ↓……
RUNTIME BINDING
இது மிகவும் முக்கியமான topic.…
Program execute ஆகிக் கொண்டிருக்கும் நேரத்தில் es……
LATE BINDING
Actual association program execut……
C++ virtual functions.…
VIRTUAL FUNCTION EXAMPLE
Why? p type: Base* ஆனால் அது poin……
இதுவே: Dynamic Binding…
STATIC VS DYNAMIC BINDING - SAME EXAMPLE
Function selection static type அடிப……
runtime-ல்.…
STATIC BINDING
Binding compile time / before execution fixed ஆகும். Also called: Early Binding C……
DYNAMIC BINDING
Binding runtime-ல் resolve ஆகிறது. Also call……
STATIC VS DYNAMIC BINDING
COMPILE-TIME POLYMORPHISM
Examples: Function Overloading Oper……
void fun(int); void fun(double); Call: f……
RUNTIME POLYMORPHISM
Achieved mainly using: Inheritance + Virtual Functions + Base pointer/refer……
MEMORY BINDING
Variable-க்கு memory allocate செய்யப்படும் time variable வகையைப் பொறுத்து மாறும். S……
LOCAL VARIABLE BINDING
Function call செய்யும்போது x-க்கு storage created ஆகும். Functi……
DYNAMIC MEMORY BINDING
int* p = new int; new execute செய்யும் போது: Heap me……
p ↓ Heap memory location ↓ 10……
VALUE BINDING
int x; cin >> x; x value user input அடிப்படையில் run……
TYPE BINDING
C++: int x; x type: int compile time-ல் fixed. Python: x = 10 Then: x = "Hello" Names and object ty……
STATIC TYPE BINDING
Type before runtime decided.…
double amount; amount → doubl……
DYNAMIC TYPE BINDING
Language variable/name type associati……
Now: x refers to integer object Later: x = "Hello" Now: x r……
NAME BINDING
Identifier எந்த declaration/entity-ஐ refer செய்……
Inside fun(): x → local x not global x. இந்த resol……
SCOPE AND BINDING
Binding மற்றும் scope closely related. Binding: Na……
Binding: x → local integer va……
LIFETIME AND BINDING
Scope மற்றும் lifetime same அல்ல. Sc……
count scope: fun() only But lifetime: Entire……
BINDING AND STORAGE ALLOCATION
Different storage categories: Static allocation Stack allocation Heap allocation Static P……
STATIC STORAGE ALLOCATION
static int count; Storage program execution duration வரை இர……
STACK DYNAMIC ALLOCATION
Function invocation: fun() ↓ Activation recor……
HEAP DYNAMIC ALLOCATION
int* p = new int; Runtime: ne……
OPERATOR BINDING
10 + 20 +: integer addition C……
- → string concatenation oper……
Appropriate overloaded operat……
METHOD BINDING
Object-oriented programming-ல் method call: obj.show(); Which show() gets execu……
VTABLE - CONCEPTUAL IDEA
C++ compilers commonly implement virtual dispatch using structures o……
The C++ language standard specifies behavior, not that every c……
DYNAMIC DISPATCH
Virtual method runtime select……
Base reference ↓ Derived object ↓ Virtual call ↓ Runtime dispatc……
EARLY BINDING ADVANTAGES
Faster execution Compiler optimization eas……
EARLY BINDING DISADVANTAGES
Less runtime flexibility More decisi……
LATE BINDING ADVANTAGES
Flexibility Runtime polymorphism Extensibility Dynamic behavior……
LATE BINDING DISADVANTAGES
Runtime overhead More complex implementat……
BINDING TIMES - COMPLETE TABLE
ONE EXAMPLE THROUGH ALL STAGES
Now inch-by-inch: Language Design Time C++ defines: class virtual new pointer meanings. Implementation Time C……
actual object: Circle so: Cir……
BINDING TIME AND FLEXIBILITY
Very important principle: Earlier Binding ↓ Less flexibi……
BINDING TIME AND LANGUAGE DESIGN
Language designer chooses whether some decision should be: Design Time Compile Ti……
BINDING TIME AND ERRORS
Early binding: Errors often detected early. int x = "Hello"; Compiler diagnostic. Late binding: Some probl……
BINDING TIME AND EFFICIENCY
If compiler already knows: Function Type Memory layout Operation it can optimize better. Therefore stat……
BINDING TIME AND POLYMORPHISM
C++ polymorphism: Compile-Time Polymorphism ↓ Static Binding Examp……
OVERLOADING VS OVERRIDING
Important connection. Overloading void show(int); void show(double); Which function? Co……
STATIC BINDING EXAMPLE
early.…
DYNAMIC BINDING EXAMPLE
Because: Actual object = B Ru……
BINDING vs ASSIGNMENT
These are not same. Binding: ……
Store/change a value…
int x; Type binding: x → int ……
10 stored in x…
BINDING vs DECLARATION
Declaration introduces entity/type. int x; Binding is broader: x ↔ i……
BINDING vs LINKING
Do not confuse. Binding General association. Linking Object……
BINDING vs SCOPE
Binding = What does the name ……
int x = 10;…
Inside fun(): x binds to loca……
Complete binding time flow: Language Designed ↓ Keywords / Syntax fixed ↓ Compiler Implemented ↓ Representati……
Most important definitions: Binding = Association between a program entity and an attribute. Binding……
Order நினைவில் வைக்க: D I C L L R D → Design Time I → Implementation Time C →……
Do not confuse: Binding ≠ Assignment Binding ≠ Linking Static Binding ≠ Static Var……
dynamic binding and dynamic memory allocation both runtime-related concepts……
1. Association between an ent……
Answer: Binding…
Time at which an association is established:
Answer: Binding Time…
Binding resolved before execution:
Answer: Static / Early Binding…
Binding resolved during execution:
Answer: Dynamic / Late Binding…
C++ virtual functions use:
Answer: Dynamic Binding…
Function overloading normally uses:
Answer: Static Binding…
External references are commonly resolved at:
Answer: Link Time…
Program mapped to memory at:
Answer: Load Time…
Heap memory allocation occurs at:
Answer: Runtime…
Runtime polymorphism depends on:
Answer: Dynamic Binding…
Binding is:…
Binding time refers to:…
Which is an example of late b……
Function overloading is gener……
External function references ……
A variable's value obtained t……
Dynamic binding is also calle……
Which is most associated with……
Which occurs before program e……
Which is the correct order?…
2 Marks: Define Binding Binding is the association of an attribute with a program entity, such as binding a v……
Binding ↓ Entity + Attribute ↓ When association occurs? ↓ Binding Time Major binding times: Language Design T……