{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

linkage

linkage - Type-safe Linkage Consider the following program...

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

View Full Document Right Arrow Icon
Type-safe Linkage Consider the following program: // test.cpp #include <iostream> using namespace std; void print(int n) { cout << "int: " << n << endl; } void print(char ch) { cout << "char: " << ch << endl; } void print(unsigned char ch) { cout << "unsigned char: " << ch << endl; } void print(float f, int n = 1) { cout << f << ’ ’ << n << endl; } int main() { print(’a’); } aw/07 1
Background image of page 1

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

View Full Document Right Arrow Icon
We’ll look at the symbols in the object file created by g ++ (version 4.1.2): $ g++ -c test.cpp $ nm test.o 00000044 t _GLOBAL__I__Z5printi 00000000 t _Z41__static_initialization_and_destruction_0ii 000000be T _Z5printc 00000074 T _Z5printfi 00000172 T _Z5printh 00000134 T _Z5printi U _ZNSolsEPFRSoS_E U _ZNSolsEf U _ZNSolsEi U _ZNSt8ios_base4InitC1Ev U _ZNSt8ios_base4InitD1Ev U _ZSt4cout U _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_ 00000000 b _ZSt8__ioinit U _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc U _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c U _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_h
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 4

linkage - Type-safe Linkage Consider the following program...

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

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