Goto Statements and C++ Compiler Optimizations

From: bytesgrip (spamtrap_at_crayne.org)
Date: 03/09/05


Date: Wed, 9 Mar 2005 21:18:01 +0000 (UTC)

Hi.

I'm programming in C++ using Visual Studio.

For efficiency purposes, I tried using the goto statement (I have a
while-loop with 3 breaking conditions - cond1&&cond2&&cond3, and after
finishing the loop, I want to know the reason for getting out).

This currently shows a nice overall performance improvement of 14%.

What I'd like to know, is whether using goto might confuse the compiler
and make it avoid doing certain optimizations. Do you know if that's
possible, or maybe just the opposite?

Thanks,
bytesgrip.



Relevant Pages

  • Re: break statement
    ... You could use the goto statement however this is ... loop -either moving the if statement test itself, or if that is not possible ... be "int variableName = value", also the names should be functionally ... For my form controls however I am currently of the opinion to prefix those ...
    (microsoft.public.dotnet.framework)
  • Re: The void** pointer breaking symmetry?
    ... Is that maybe all an urban legend? ... hopes that future versions of the C standard will cut the crap and save ... outer loop, which will save another bunch of millions. ... an easy workaround: the goto statement. ...
    (comp.lang.c)
  • Re: acceptable use of goto?
    ... Ed Prochak wrote, On 20/03/08 17:17: ... than using the goto statement. ... Branching should only go ... Wait until you have worked on code that branches forward in to a loop, forward within the loop at various points, then forward out of the loop. ...
    (comp.lang.c)
  • Re: F90 coder needs help with F77-style control flow
    ... Can anyone help me understand what this goto statement is actually ... It gets out of the loop, and out of any loops inside the one displayed ... maxiter ... if exit bigloop ...
    (comp.lang.fortran)
  • Re: loops - Case where gotos cannot be removed (optimization)
    ... void myfuncA ... switch { ... Not even one goto statement. ... A loop construct to ...
    (comp.lang.c)