|
Watson! who's that rude fellow 
|
|
|
|
|
Well, probably is just one of his friends.
Uhm... A very-very-good-friend since he knows about his CP account details.
Oh Yes, he was his best friend.
Now everyone knows that somebody's best friend is just himself, hence... I'm confused Holmes, please explain...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Arsène Lupin?!
Maxwell Chen
|
|
|
|
|
ROTFL !!!
So you got him.
Uhm.. congrats ![Rose | [Rose]](https://www.codeproject.com/script/Forums/Images/rose.gif)
|
|
|
|
|
Yet another "A friend of mine..." story. Get a life, mate.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
CPallini wrote: See here.
The link is broken. It is not an absolute URL.
Maxwell Chen
|
|
|
|
|
You're right but I think it was a CP bug, not mine.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: it was a CP bug
Take the [PermaLink] to open a new window, and copy that new URL. It will solve!
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: and copy that new URL. It will solve!
how's that possible, do you hacked your domain server policy [^]

|
|
|
|
|
Rajkumar R wrote: how's that possible, do you hacked your domain server policy [^]
I'm home ~~~
Maxwell Chen
|
|
|
|
|
I told you it was a CP issue. Now it's working fine without my intervention.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: I told you it was a CP issue. Now it's working fine without my intervention.
Yes, indeed!
Maxwell Chen
|
|
|
|
|
Hi,
For some reason, I need to launch an application from my c++ code while holding the Alt key.
the code is really simple:
<br />
char appName[64];<br />
strcpy(appName,"c:\\WINDOWS\\notepad.exe");<br />
ShellExecute(hWnd,"open",appName,NULL,NULL,SW_SHOWNORMAL);<br />
But when executed whith the Alt key down, the application is opened behind the main window
Does anyone have any clue fro this ?
I appreciate your help.
Thanks
|
|
|
|
|
Hello everyone,
According to standard, the code should not compile.
http://gcc.gnu.org/onlinedocs/gcc/Name-lookup.html
template <typename T> struct Base {
int i;
};
template <typename T> struct Derived : public Base<T> {
int get_i() { return i; }
};
But it can compile without any issues in Visual Studio 2008, without any warnings and even if I select disable language extensions to yes.
Any comments? What is wrong?
thanks in advance,
George
|
|
|
|
|
George_George wrote: According to standard, the code should not compile.
What do you mean with standard?
As far as I can tell the snippit looks fine. And i think that the manual is wrong on this one.
They state: In get_i(), i is not used in a dependent context according to me this is wrong since i is without any doubt the Base<T>::i which is known.
This is indeed a strange situation.
codito ergo sum
|
|
|
|
|
Thanks BadKarma,
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).
--------------------
2.
What disadvantage do we have if the code can compile?
regards,
George
|
|
|
|
|
I think current versions of VC++ treat this issue in the manner treating non-template name hiding stuff. Such as:
int a = 3;
for(int i = 0, a = 0; i < 2; i++) {
printf("a = %d \n", a);
}
printf("a = %d \n", a);
Result:
a = 0
a = 3
Maxwell Chen
|
|
|
|
|
Hi Maxwell,
1. I think Visual Studio 2008 provides correct result in the sample you provided. Are there anything wrong?
2. Does your sample have anything related to my question?
regards,
George
|
|
|
|
|
George_George wrote: 1. I think Visual Studio 2008 provides correct result in the sample you provided. Are there anything wrong?
2. Does your sample have anything related to my question?
1. I haven't found where in the ISO C++:2003 states how this issue should be working.
But, remember?! You posted Stroustrup's words in previous thread.
And that quote matches GCC document's statement.
2. Something about name resolution ...
Maxwell Chen
|
|
|
|
|
|
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
|
|
|
|
|
The intention Stroustrup and the ISO C++ team defined this seems because they hoped to avoid the "nasty macro-like behaviours" (see George's previous thread).
Maxwell Chen
|
|
|
|
|
Hi Maxwell,
I understand what means "nasty macro-like behaviours", but I do not think "nasty macro-like behaviours" is similar to my sample in original question?
regards,
George
|
|
|
|
|
George_George wrote: I understand what means "nasty macro-like behaviours", but I do not think "nasty macro-like behaviours" is similar to my sample in original question?
Your sample in the original question in this thread originated from your previous thread quoting Stroustrup's words. You forgot?!
Maxwell Chen
|
|
|
|
|
Don't push me doing copy-and-paste!!
Maxwell Chen
|
|
|
|