Click here to Skip to main content
15,918,109 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: please help me. Pin
Le@rner21-Apr-08 18:00
Le@rner21-Apr-08 18:00 
GeneralFailed to initialize object in a constructor Pin
cydd7-Mar-08 23:55
cydd7-Mar-08 23:55 
AnswerRe: Failed to initialize object in a constructor [modified] Pin
Rajkumar R8-Mar-08 0:00
Rajkumar R8-Mar-08 0:00 
GeneralRe: Failed to initialize object in a constructor Pin
cydd8-Mar-08 22:37
cydd8-Mar-08 22:37 
Generalgraph plotting.. Pin
Member 47738777-Mar-08 23:00
Member 47738777-Mar-08 23:00 
GeneralRe: graph plotting.. Pin
CPallini7-Mar-08 23:35
mveCPallini7-Mar-08 23:35 
GeneralRe: graph plotting.. Pin
Member 47738778-Mar-08 0:51
Member 47738778-Mar-08 0:51 
Generalinstantiation point discussion Pin
George_George7-Mar-08 22:24
George_George7-Mar-08 22:24 
Hello everyone,


We have a lot of discussion in the two days, seems points from people are not quite the same (at least to some degree). Let me quote the original statement from Bjarne and code again here.

My question is,

1. if you agree g(int) -- declaration only -- will not instantise function f to f<int>, which conflicts with Bjarne's point, could you provide some code to prove please?

2. if you agree with Bjarne's points, g(int) -- declaration only -- will instantise function f to f<int>, could you also provide some code to prove please?

My point is (1), since I think VC instantise a template only when we use it other than deduce any information from template definition phase -- but I can not prove it. If you could prove (1), it is great!

// section C.13.8.3 Point of Instantiatant Binding

template <class T> void f (T a) { g(a); }

void g(int);

void h()
{
	extern g (double);
	f (2);
}


--------------------
the point of instantiation for f<int>() is just before h(), so the g() called in f() is the global g (int) rather than the local g (double).
--------------------

BTW: from above statement from Bjarne, I think he means declaration of g(int) before h() will instiatise f to f <int>.


thanks in advance,
George
GeneralRe: instantiation point discussion Pin
Rajkumar R7-Mar-08 22:43
Rajkumar R7-Mar-08 22:43 
GeneralRe: instantiation point discussion Pin
George_George7-Mar-08 23:01
George_George7-Mar-08 23:01 
GeneralRe: instantiation point discussion Pin
Rajkumar R7-Mar-08 23:23
Rajkumar R7-Mar-08 23:23 
GeneralRe: instantiation point discussion Pin
George_George8-Mar-08 22:03
George_George8-Mar-08 22:03 
GeneralRe: instantiation point discussion Pin
Rajkumar R9-Mar-08 2:07
Rajkumar R9-Mar-08 2:07 
GeneralRe: instantiation point discussion Pin
George_George9-Mar-08 2:24
George_George9-Mar-08 2:24 
GeneralRe: instantiation point discussion Pin
Rajkumar R9-Mar-08 3:01
Rajkumar R9-Mar-08 3:01 
GeneralRe: instantiation point discussion Pin
George_George9-Mar-08 3:15
George_George9-Mar-08 3:15 
AnswerRe: instantiation point discussion Pin
Rajkumar R9-Mar-08 3:27
Rajkumar R9-Mar-08 3:27 
GeneralRe: instantiation point discussion Pin
George_George9-Mar-08 15:28
George_George9-Mar-08 15:28 
GeneralMSDN template sample Pin
George_George7-Mar-08 20:36
George_George7-Mar-08 20:36 
GeneralRe: MSDN template sample Pin
CPallini7-Mar-08 23:29
mveCPallini7-Mar-08 23:29 
GeneralRe: MSDN template sample Pin
George_George8-Mar-08 21:59
George_George8-Mar-08 21:59 
GeneralRe: MSDN template sample Pin
CPallini8-Mar-08 22:55
mveCPallini8-Mar-08 22:55 
GeneralRe: MSDN template sample Pin
George_George9-Mar-08 2:05
George_George9-Mar-08 2:05 
GeneralRe: MSDN template sample Pin
CPallini9-Mar-08 3:57
mveCPallini9-Mar-08 3:57 
GeneralRe: MSDN template sample Pin
George_George9-Mar-08 15:22
George_George9-Mar-08 15:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.