Click here to Skip to main content
15,891,769 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: vector question Pin
RobJones3-Sep-09 12:12
RobJones3-Sep-09 12:12 
QuestionTemplates... they are nasty!! Pin
o.kauert3-Sep-09 11:43
o.kauert3-Sep-09 11:43 
AnswerRe: Templates... they are nasty!! Pin
Nemanja Trifunovic3-Sep-09 12:20
Nemanja Trifunovic3-Sep-09 12:20 
AnswerRe: Templates... they are nasty!! [modified] Pin
Chris Losinger3-Sep-09 16:15
professionalChris Losinger3-Sep-09 16:15 
GeneralRe: Templates... they are nasty!! Pin
«_Superman_»3-Sep-09 17:41
professional«_Superman_»3-Sep-09 17:41 
GeneralRe: Templates... they are nasty!! Pin
o.kauert3-Sep-09 23:14
o.kauert3-Sep-09 23:14 
AnswerRe: Templates... they are nasty!! Pin
Stuart Dootson3-Sep-09 21:44
professionalStuart Dootson3-Sep-09 21:44 
GeneralRe: Templates... they are nasty!! Pin
o.kauert3-Sep-09 23:27
o.kauert3-Sep-09 23:27 
Stuart Dootson wrote:
See, when VC++ instantiates the call to clear, it needs to instantiate the template class Array<array<arrayelement>*>. It wants a vtable for that class, so it'll need an instantiation of split for that class. While instantiating split, it'll need to instantiate the call to clear, so it'll instantiate the class Array<array<array<arrayelement>*>*>....

And so on, ad infinitum...


Yes, I totally agree with you here and already knew that this happens. But it makes no sense to me as the compiler should only generate code that is USED. The code that the compiler generates here is not used anywhere - it COULD be used but it's not. Leave away the "virtual" keyword and suddenly it compiles without problems. Thinking of it I see no difference between the two versions as the compiler could also generate code until infinity without the "virtual" keyword. For me it seems like a VS 2008 compiler specific issue and I will certainly try the GCC compiler soon. (Must prepare my full project for that however.)


Stuart Dootson wrote:
void clear()
{
split();
}



g++ won't compile this, giving an error message very similar to the VC++ warnings you were getting.


Err, what you are doing here is an OBVIOUS recursion that could not even be executed without stack overflow Wink | ;) The one in my code example isn't. What it's really about is code generation that does take place although the generated code is not actually needed. I will certainly never ever use a Array<Array<Array<Array<Array<Array<Array<Array<ArrayElement>...> container ANYWHERE Smile | :) So why does the compiler think I will?
GeneralRe: Templates... they are nasty!! Pin
Stuart Dootson3-Sep-09 23:37
professionalStuart Dootson3-Sep-09 23:37 
GeneralRe: Templates... they are nasty!! Pin
o.kauert4-Sep-09 0:54
o.kauert4-Sep-09 0:54 
GeneralRe: Templates... they are nasty!! Pin
Stuart Dootson4-Sep-09 1:00
professionalStuart Dootson4-Sep-09 1:00 
GeneralRe: Templates... they are nasty!! Pin
o.kauert4-Sep-09 1:40
o.kauert4-Sep-09 1:40 
GeneralRe: Templates... they are nasty!! Pin
Stuart Dootson4-Sep-09 1:52
professionalStuart Dootson4-Sep-09 1:52 
QuestionPlaySound(MAKEINTRESOURCE, IDR_WAVE_RANDOM... problem Pin
lctrncs3-Sep-09 7:08
lctrncs3-Sep-09 7:08 
QuestionRe: PlaySound(MAKEINTRESOURCE, IDR_WAVE_RANDOM... problem Pin
David Crow3-Sep-09 7:18
David Crow3-Sep-09 7:18 
AnswerRe: PlaySound(MAKEINTRESOURCE, IDR_WAVE_RANDOM... problem Pin
lctrncs3-Sep-09 12:27
lctrncs3-Sep-09 12:27 
GeneralRe: PlaySound(MAKEINTRESOURCE, IDR_WAVE_RANDOM... problem Pin
David Crow3-Sep-09 18:15
David Crow3-Sep-09 18:15 
GeneralRe: PlaySound(MAKEINTRESOURCE, IDR_WAVE_RANDOM... problem Pin
lctrncs3-Sep-09 19:09
lctrncs3-Sep-09 19:09 
AnswerRe: PlaySound(MAKEINTRESOURCE, IDR_WAVE_RANDOM... problem Pin
iraclyKv3-Sep-09 22:58
iraclyKv3-Sep-09 22:58 
AnswerMore Detailed Information About the Problem Re: PlaySound(MAKEINTRESOURCE, IDR_WAVE_RANDOM... problem Pin
lctrncs4-Sep-09 9:06
lctrncs4-Sep-09 9:06 
QuestionHow to create detailed log.txt file in C programming. Pin
mohant$.net3-Sep-09 3:00
mohant$.net3-Sep-09 3:00 
AnswerRe: How to create detailed log.txt file in C programming. Pin
Hamid_RT3-Sep-09 3:28
Hamid_RT3-Sep-09 3:28 
AnswerRe: How to create detailed log.txt file in C programming. Pin
Maximilien3-Sep-09 3:44
Maximilien3-Sep-09 3:44 
QuestionRe: How to create detailed log.txt file in C programming. Pin
David Crow3-Sep-09 5:10
David Crow3-Sep-09 5:10 
AnswerRe: How to create detailed log.txt file in C programming. Pin
Chris Losinger3-Sep-09 11:31
professionalChris Losinger3-Sep-09 11:31 

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.