The D Programming Language

Richard Harter g-rh at cca.CCA.COM
Thu Feb 25 19:35:33 AEST 1988


In article <2731 at mmintl.UUCP> franka at mmintl.UUCP (Frank Adams) writes:
>In article <2327 at umd5.umd.edu> chris at trantor.umd.edu (Chris Torek) writes:
>
>|[may prefer 'endif' to 'end', but has doubts]
>
>I debated whether to put in 'endif', etc., or 'end' in the above, and
>finally opted for the shorter form.  Ask me on another day and you might get
>a different answer.

Here is an alternative to endif et al.  Use labels to start blocks and
'end labels' to end them.  For example,

	if (boolean expression)
foo:		....
		end foo
	else
bar:		....
		end bar

This may look odd, but it does have the advantage that it makes the block
delimiting explicit.  One would also need to be able to use unlabelled blocks
(in macros, for example), so

	if (boolean expression)
		....
		end
	else
		....
		end

would also fly.  A disadvantage (from some viewpoints) is that, since labels
now delimit control blocks, they can't be used for goto's.

Sometimes, I think this might be a good idea.
-- 

In the fields of Hell where the grass grows high
Are the graves of dreams allowed to die.
	Richard Harter, SMDS  Inc.



More information about the Comp.lang.c mailing list