Click here to Skip to main content
15,890,506 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionwhich is the best open source library for 2D drawings. Pin
Member 935377623-Aug-12 20:10
Member 935377623-Aug-12 20:10 
AnswerRe: which is the best open source library for 2D drawings. Pin
Software_Developer23-Aug-12 22:45
Software_Developer23-Aug-12 22:45 
QuestionBetter "pattern" for if-else if for strings ? Pin
Maximilien23-Aug-12 3:57
Maximilien23-Aug-12 3:57 
AnswerRe: Better "pattern" for if-else if for strings ? Pin
pasztorpisti23-Aug-12 4:49
pasztorpisti23-Aug-12 4:49 
AnswerRe: Better "pattern" for if-else if for strings ? Pin
Mihai Vrinceanu23-Aug-12 5:41
Mihai Vrinceanu23-Aug-12 5:41 
GeneralRe: Better "pattern" for if-else if for strings ? Pin
_Flaviu23-Aug-12 8:36
_Flaviu23-Aug-12 8:36 
SuggestionRe: Better "pattern" for if-else if for strings ? Pin
David Crow23-Aug-12 5:53
David Crow23-Aug-12 5:53 
AnswerRe: Better "pattern" for if-else if for strings ? Pin
jschell23-Aug-12 8:22
jschell23-Aug-12 8:22 
Maximilien wrote:
t is there a better way to do cascading If comparisons on strings


Where "better" means what?

If you just don't like looking at the code then you could do code generation.

If there is a actual profiled performance problem traced to this then you can used collected data to order the comparisons with most used first and least used last. Depending on the number of strings, and the data in the strings other optimizations are possible.

One solution again dependent on data and usage is to parse the input, when first received, into a value such as an enumeration and only use that in the rest of the code.

If there is a lot of churn with these then generation can still help but dynamic collections might solve that, with care. However such solutions might not be as performant and add some level of complexity.
AnswerRe: Better "pattern" for if-else if for strings ? Pin
_Flaviu23-Aug-12 8:33
_Flaviu23-Aug-12 8:33 
AnswerRe: Better "pattern" for if-else if for strings ? Pin
CPallini23-Aug-12 22:54
mveCPallini23-Aug-12 22:54 
AnswerRe: Better "pattern" for if-else if for strings ? Pin
Chris Losinger24-Aug-12 1:20
professionalChris Losinger24-Aug-12 1:20 
GeneralRe: Better "pattern" for if-else if for strings ? Pin
CPallini24-Aug-12 1:53
mveCPallini24-Aug-12 1:53 
GeneralRe: Better "pattern" for if-else if for strings ? Pin
pasztorpisti24-Aug-12 2:20
pasztorpisti24-Aug-12 2:20 
GeneralRe: Better "pattern" for if-else if for strings ? Pin
Maximilien24-Aug-12 4:04
Maximilien24-Aug-12 4:04 
AnswerRe: Better "pattern" for if-else if for strings ? Pin
bkelly1326-Aug-12 15:55
bkelly1326-Aug-12 15:55 
Questionrun bat file using ShellExecute Pin
manju 323-Aug-12 2:16
manju 323-Aug-12 2:16 
AnswerRe: run bat file using ShellExecute Pin
Chris Meech23-Aug-12 2:20
Chris Meech23-Aug-12 2:20 
AnswerRe: run bat file using ShellExecute Pin
pasztorpisti23-Aug-12 3:07
pasztorpisti23-Aug-12 3:07 
QuestionWrite to Text file using fprintf Pin
manju 323-Aug-12 1:06
manju 323-Aug-12 1:06 
AnswerRe: Write to Text file using fprintf Pin
Richard MacCutchan23-Aug-12 1:56
mveRichard MacCutchan23-Aug-12 1:56 
GeneralRe: Write to Text file using fprintf Pin
CPallini23-Aug-12 22:55
mveCPallini23-Aug-12 22:55 
GeneralRe: Write to Text file using fprintf Pin
Richard MacCutchan23-Aug-12 23:47
mveRichard MacCutchan23-Aug-12 23:47 
GeneralRe: Write to Text file using fprintf Pin
CPallini25-Aug-12 7:25
mveCPallini25-Aug-12 7:25 
GeneralRe: Write to Text file using fprintf Pin
Richard MacCutchan25-Aug-12 7:29
mveRichard MacCutchan25-Aug-12 7:29 
AnswerRe: Write to Text file using fprintf Pin
pasztorpisti23-Aug-12 1:59
pasztorpisti23-Aug-12 1:59 

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.