From: Pascal J. Bourguignon on
"Daniel T." <daniel_t(a)earthlink.net> writes:

> Richard Heathfield <rjh(a)see.sig.invalid> wrote:
>> Nick Keighley wrote:
>
>> > Your code compiles and runs and gives the same answers for both
>> > functions.
>> >
>> > But it still says they both have a complexity of 5
>> > Ah, but the graphs look much more similar. Near identical.
>> > Pictures on their way
>>
>> And now they're on the Web. Please note that, as the URL suggests...
>>
>> <http://www.cpax.org.uk/scratch/seseseme.php>
>>
>> ...I'm liable to reclaim that scratch space at any time. (In practice,
>> I'll probably be too lazy, though, so the link should be good for a
>> little while yet.)
>>
>> Personally, I find the SESE (right-hand) version to be visually simpler.
>
> Something interesting that I've noticed over the years. In every
> debugger I've used (maybe 5 in all,) when I'm stepping through the code
> and the code point hits a return statement, the next step doesn't exit
> the function, instead it jumps to the close brace that ends the
> function. By that light, all functions are SESE even if you put multiple
> returns in them.

That's because there's a non trivial epilog that must be executed
therefore the compiler translates the returns into jumps to the epilog
instead of a single RTN instruction.

However, you could probably play with optimization options and have the
compiler generate several returns. (Notably, disabling the frames for
functions who don't need them).


--
__Pascal Bourguignon__