` Printed Icetips Article

Icetips Article



Clarion in general: Create a string reference and disposing of it
2003-08-31 -- Alexey Solovjev
 
Newsgroups: sv.clarion.compilers

Hello,

> From: carl barnes 
> Date: 31 Aug 2003 21:39:52 -0400

> It seems like there should be a simple  way to return a NEW STRING and not leak
> and not use a STATIC. I looked thru the Help and don't see it.

Does following program do what you want?

=====

        PROGRAM

        MAP
          S(UNSIGNED),*STRING
        END

Ref     &STRING,AUTO

  CODE
  Ref &= S (80)
  Ref = ALL ('*', SIZE(Ref))
  MESSAGE (Ref, 'Test')
  DISPOSE (Ref)
  RETURN

S  PROCEDURE (UNSIGNED L)

RS  &STRING,AUTO

  CODE
  RS &= NEW STRING (L)
  RETURN RS

=====



Printed May 3, 2024, 4:07 pm
This article has been viewed/printed 35111 times.
Google search has resulted in 7 hits on this article since January 25, 2004.