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

C / C++ / MFC

 
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 
GeneralRe: Templates... they are nasty!! Pin
Stuart Dootson3-Sep-09 23:37
professionalStuart Dootson3-Sep-09 23:37 
o.kauert wrote:
But it makes no sense to me as the compiler should only generate code that is USED.


VC++ has historically had issues with instantiating more than it necessarily needed with templates.

o.kauert wrote:
Err, what you are doing here is an OBVIOUS recursion that could not even be executed without stack overflow


Yes it could be executed. The condition within split (if (result != 0)) will terminate recursion at run-time. However, the compiler cannot reliably and economically perform the static analysis required to see that and know that the first call to split from clear will terminate the recursion, meaning it doesn't need an instantiation of clear to be called at that point.

o.kauert wrote:
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 So why does the compiler think I will?


Because it's unable to see as far as you - it doesn't have the knowledge of your design intent. It has to follow pre-defined rules about what to instantiate.

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

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 
QuestionCursor freeze in rich edit control Pin
theCPkid3-Sep-09 2:47
theCPkid3-Sep-09 2:47 

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.