On Sunday 24 November 2013 14:48:05 Marcos Douglas wrote: > You can not protect the programmers using this. Think. Even if you use > 'return', 'result', whatever... if the programmer put a Exit on your > code the same error will happen! Bad programmers do it. They forget to > create some object, don't destroy them, etc. Who cares! No language > can protect all source.
OK, I'll remove 'return' from MSElang, one source less (MSElang has no 'exit'). ;-) The argument is, it should be possible to program without 'return' if one wants a safe coding style therefore the assignment at function end. > > Pardon me but your algorithm -- I know this is just an example -- is > wrong. You do not need to use GOTO. > Using the real Pascal: > " > begin > result:= 0; //initilization > if a then //long deeply nested processing > result:= 123 > else > begin > if b and c then > result:= -100 > else > begin > if not (a or b) then > begin > result := 1000; > globflag:= true; > exit; > end > else > result:= 88; > end; > end; > globflag:= result > 0; > end; > " The two things every Delphi expert writes: - *never* use 'goto', it is dirty! - do *not* use 'with', it is evil! Because I am no Delphi expert I think both statements are wrong. ;-) The 'exit' (or return) statement actually is a "goto end". A 'goto' has a 'label' definition in header and a left aligned label, much better than 'exit' which easy can be overlooked. Martin ------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk _______________________________________________ mseide-msegui-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

