Click here to Skip to main content
15,922,325 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ DB : SQLServer : SQLExecute - Insert statement returning Error -2 Pin
SureshBL19-May-20 13:19
SureshBL19-May-20 13:19 
GeneralRe: C++ DB : SQLServer : SQLExecute - Insert statement returning Error -2 Pin
SureshBL19-May-20 13:25
SureshBL19-May-20 13:25 
GeneralRe: C++ DB : SQLServer : SQLExecute - Insert statement returning Error -2 Pin
jeron120-May-20 4:46
jeron120-May-20 4:46 
Questionkernel32.lib Pin
Calin Negru18-May-20 11:10
Calin Negru18-May-20 11:10 
AnswerRe: kernel32.lib Pin
Daniel Pfeffer18-May-20 19:49
professionalDaniel Pfeffer18-May-20 19:49 
GeneralRe: kernel32.lib Pin
Calin Negru19-May-20 0:02
Calin Negru19-May-20 0:02 
QuestionHow is this possible? Pin
Tim ONeil17-May-20 4:47
Tim ONeil17-May-20 4:47 
AnswerRe: How is this possible? Pin
Richard MacCutchan17-May-20 5:31
mveRichard MacCutchan17-May-20 5:31 
GeneralRe: How is this possible? Pin
Tim ONeil17-May-20 5:39
Tim ONeil17-May-20 5:39 
GeneralRe: How is this possible? Pin
Richard MacCutchan17-May-20 6:28
mveRichard MacCutchan17-May-20 6:28 
GeneralRe: How is this possible? Pin
Richard MacCutchan17-May-20 22:12
mveRichard MacCutchan17-May-20 22:12 
GeneralRe: How is this possible? Pin
Richard MacCutchan19-May-20 23:55
mveRichard MacCutchan19-May-20 23:55 
AnswerRe: How is this possible? Pin
Mircea Neacsu19-May-20 3:09
Mircea Neacsu19-May-20 3:09 
PraiseRe: How is this possible? Pin
Greg Utas19-May-20 3:37
professionalGreg Utas19-May-20 3:37 
GeneralRe: How is this possible? Pin
Richard MacCutchan19-May-20 3:37
mveRichard MacCutchan19-May-20 3:37 
GeneralRe: How is this possible? Pin
Mircea Neacsu19-May-20 3:57
Mircea 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
Mircea 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
Mircea 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
Mircea 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.
C++
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
Mircea Neacsu20-May-20 2:44 
GeneralRe: How is this possible? Pin
Richard MacCutchan19-May-20 4:18
mveRichard MacCutchan19-May-20 4:18 

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.