Click here to Skip to main content
15,897,273 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalanti-standard code can compile -- about template class Pin
George_George6-Mar-08 21:37
George_George6-Mar-08 21:37 
GeneralRe: anti-standard code can compile -- about template class Pin
BadKarma6-Mar-08 21:56
BadKarma6-Mar-08 21:56 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George6-Mar-08 22:30
George_George6-Mar-08 22:30 
GeneralRe: anti-standard code can compile -- about template class Pin
Maxwell Chen6-Mar-08 22:59
Maxwell Chen6-Mar-08 22:59 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George6-Mar-08 23:22
George_George6-Mar-08 23:22 
GeneralRe: anti-standard code can compile -- about template class Pin
Maxwell Chen6-Mar-08 23:31
Maxwell Chen6-Mar-08 23:31 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 0:22
George_George7-Mar-08 0:22 
GeneralRe: anti-standard code can compile -- about template class Pin
BadKarma6-Mar-08 22:59
BadKarma6-Mar-08 22:59 
George_George wrote:
Seems like Visual Studio is wrong. Please look at section 35.19 of,

http://www.parashift.com/c++-faq-lite/templates.html#faq-35.19[^]

1.I think this line of statement matters, agree?

--------------------
the compiler does not look in dependent base classes (like B<t> when looking up nondependent names (like f).
--------------------


This is correct Visual Studio compiles the non-valid code without any troubles

George_George wrote:
2. What disadvantage do we have if the code can compile?


Thats a hard one since Visual Studio compiles and provides the correct solution. Even when there are global variables or function is correctly understand what the programmer wants and does a check the base class first.

This brings us too two other questions one might ask.
1. Can one write code which breaks this rule? Meaning, can on write code that explicit calls the global function instead of the base function?
2. If this is not possible, why does the rule: the compiler does not look in dependent base classes (like B<t> when looking up nondependent names (like f). exist? Is it because older compilers where not smart enough to clear this up?

codito ergo sum

GeneralRe: anti-standard code can compile -- about template class Pin
Maxwell Chen6-Mar-08 23:06
Maxwell Chen6-Mar-08 23:06 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George6-Mar-08 23:24
George_George6-Mar-08 23:24 
GeneralRe: anti-standard code can compile -- about template class Pin
Maxwell Chen6-Mar-08 23:35
Maxwell Chen6-Mar-08 23:35 
JokeRe: anti-standard code can compile -- about template class Pin
Maxwell Chen6-Mar-08 23:41
Maxwell Chen6-Mar-08 23:41 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 0:21
George_George7-Mar-08 0:21 
GeneralRe: anti-standard code can compile -- about template class Pin
Maxwell Chen7-Mar-08 3:09
Maxwell Chen7-Mar-08 3:09 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 3:18
George_George7-Mar-08 3:18 
GeneralRe: anti-standard code can compile -- about template class Pin
Maxwell Chen7-Mar-08 3:23
Maxwell Chen7-Mar-08 3:23 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 3:37
George_George7-Mar-08 3:37 
GeneralRe: anti-standard code can compile -- about template class Pin
Maxwell Chen7-Mar-08 3:56
Maxwell Chen7-Mar-08 3:56 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 20:21
George_George7-Mar-08 20:21 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 0:20
George_George7-Mar-08 0:20 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 0:19
George_George7-Mar-08 0:19 
GeneralRe: anti-standard code can compile -- about template class Pin
BadKarma7-Mar-08 1:11
BadKarma7-Mar-08 1:11 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 1:13
George_George7-Mar-08 1:13 
GeneralRe: anti-standard code can compile -- about template class Pin
BadKarma7-Mar-08 1:35
BadKarma7-Mar-08 1:35 
GeneralRe: anti-standard code can compile -- about template class Pin
George_George7-Mar-08 1:39
George_George7-Mar-08 1:39 

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.