` 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 November 23, 2024, 5:55 am
This article has been viewed/printed 35209 times.
Google search has resulted in 7 hits on this article since January 25, 2004.