[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: RE: what is c_local?
R. Allan Reese
> On Fri, 12 Dec 2003 13:25:42 -0000 Nick Cox <firstname.lastname@example.org>
> > Sometimes, it is nice to be able to
> > have a way round the rule and to have
> > a way of passing information back
> > to a calling program. (There are of course
> > other ways of doing this, not least globals.)
> > What the -c_local- does is carry out
> > a macro definition in the calling program's
> > space. So the -display- will show 2.
> > Warning: this is dangerous unless you really understand it.
> As described, it looks not only dangerous but pointless
> what happens
> if pest is called from another routine without a defined kardos?
> c_local looks "nowt nor summit". It looks similar to Fortran's
> block equivalence and might have a marginal efficiency gain at
> run-time, but such effects should be achieved by passing parameters
> and returning results.
It's immaterial what's going on in the calling routine. That's
a consequence of the way local macros can just spring into existence.
c_local kardos = 2
is fine, syntactically.
I am not up on programming dogmata; I've merely
found this very useful in practice. What is more, you
can pass parameters at the same time.
If it offends purists, and there is clearly an
argument against it (namely, "local" should mean
precisely that), it is entirely avoidable.
P.S. This is an international list, so I'll
explain for anyone needing it that Allan is lapsing into
Yorkshire, or more loosely Northern English, dialect.
"Nowt" means nothing and "summat" [sic] means "something".
* For searches and help try: