Click here to Skip to main content
15,029,308 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How is this possible? Pin
Mircea Neacsu19-May-20 3:57
mvaMircea Neacsu19-May-20 3:57 
GeneralRe: How is this possible? Pin
Richard MacCutchan19-May-20 4:16
mveRichard MacCutchan19-May-20 4:16 
GeneralRe: How is this possible? Pin
Mircea Neacsu19-May-20 5:08
mvaMircea Neacsu19-May-20 5:08 
GeneralRe: How is this possible? Pin
Richard MacCutchan19-May-20 5:24
mveRichard MacCutchan19-May-20 5:24 
GeneralRe: How is this possible? Pin
Mircea Neacsu19-May-20 6:07
mvaMircea Neacsu19-May-20 6:07 
GeneralRe: How is this possible? Pin
Richard MacCutchan19-May-20 21:36
mveRichard MacCutchan19-May-20 21:36 
GeneralRe: How is this possible? Pin
Mircea Neacsu20-May-20 2:40
mvaMircea Neacsu20-May-20 2:40 
GeneralRe: How is this possible? Pin
Richard MacCutchan19-May-20 23:22
mveRichard MacCutchan19-May-20 23:22 
Mircea Neacsu wrote:
If you move your main to a different CPP file you will run into errors.
But not too difficult to fix with a little thought. The problem is that the implementation in stack.cpp is still a bunch of templates, so when compiled it does not generate any code. I discovered this by generating the assembly listing. So I added the following dummy function to stack.cpp which instantiates one of every template function and it compiles and links cleanly.
void sample()
{
    stack<T> dummy;
    dummy.push("A");
    dummy.size();
    dummy.top();
    dummy.pop();
    dummy.invert();
}


Oh, and I missed the part in the original which said "do not amend stack.h unless you see any mistakes". The mistake of course was all those lower case 't's in the templates. Changing them to upper case fixes it.

So my take home is that I learned a few useful things, including how not to use templates. But I think the test was valid as it is a good challenge for the candidate. Had he got it right it would probably have created an opportunity to discuss the whole thing with the people who devised the test. I don't think they are as dumb as first appears.
GeneralRe: How is this possible? Pin
Mircea Neacsu20-May-20 2:44
mvaMircea Neacsu20-May-20 2:44 
GeneralRe: How is this possible? Pin
Richard MacCutchan19-May-20 4:18
mveRichard MacCutchan19-May-20 4:18 
AnswerRe: How is this possible? Pin
Richard MacCutchan19-May-20 21:38
mveRichard MacCutchan19-May-20 21:38 
QuestionQueryPerformanceCounter Pin
CalinNegru(fearless_)16-May-20 2:16
MemberCalinNegru(fearless_)16-May-20 2:16 
AnswerRe: QueryPerformanceCounter Pin
Greg Utas16-May-20 2:29
mvaGreg Utas16-May-20 2:29 
GeneralRe: QueryPerformanceCounter Pin
CalinNegru(fearless_)16-May-20 3:11
MemberCalinNegru(fearless_)16-May-20 3:11 
AnswerRe: QueryPerformanceCounter Pin
Richard MacCutchan16-May-20 2:58
mveRichard MacCutchan16-May-20 2:58 
GeneralRe: QueryPerformanceCounter Pin
CalinNegru(fearless_)16-May-20 23:00
MemberCalinNegru(fearless_)16-May-20 23:00 
GeneralProject Pin
Hayley Satjan15-May-20 0:32
MemberHayley Satjan15-May-20 0:32 
GeneralRe: Project Pin
Richard MacCutchan15-May-20 0:51
mveRichard MacCutchan15-May-20 0:51 
GeneralRe: Project Pin
CPallini15-May-20 1:44
mveCPallini15-May-20 1:44 
GeneralRe: Project Pin
charlieg18-May-20 12:59
Membercharlieg18-May-20 12:59 
QuestionCaret not displayed in CEdit control with focus when dialog initially displayed Pin
Member 1106593314-May-20 23:35
MemberMember 1106593314-May-20 23:35 
AnswerRe: Caret not displayed in CEdit control with focus when dialog initially displayed Pin
Richard MacCutchan14-May-20 23:53
mveRichard MacCutchan14-May-20 23:53 
GeneralRe: Caret not displayed in CEdit control with focus when dialog initially displayed Pin
Member 1106593315-May-20 0:36
MemberMember 1106593315-May-20 0:36 
GeneralRe: Caret not displayed in CEdit control with focus when dialog initially displayed Pin
Richard MacCutchan15-May-20 0:48
mveRichard MacCutchan15-May-20 0:48 
QuestionPossible to #if in case an enum exists? Pin
arnold_w11-May-20 22:21
Memberarnold_w11-May-20 22:21 

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.