You are here: Surpac Concepts > Macros > TCL > TCL Commands > S - Z > unset
GEOVIA Surpac

unset

NAME

unset - Delete variables

SYNOPSIS

unsetname ?name name ...?

DESCRIPTION

This command removes one or more variables. Each name is a variable name, specified in any of the ways acceptable to the set command. If a name refers to an element of an array then that element is removed without affecting the rest of the array. If a name consists of an array name with no parenthesized index, then the entire array is deleted. The unset command returns an empty string as result. An error occurs if any of the variables doesn't exist, and any variables after the non-existent one are not deleted.

SCL Extension

Any variable that refers to an SCL object, e.g. a Guido object, a SWA, etc. is treated specially when the variable is unset.

If the variable that is unset contains the last known reference to the object in question, then that object is automatically destroyed when the variable is unset. This behaviour makes the development of memory efficient applications using SCL simple as special care to prevent memory holes from ocurring is not required. Memory holes are caused by poor programming practise where allocated memory is not freed before all references to that memory are lost.

This behaviour, that is automatically freeing memory when no more references to the memory exists, also ocurrs when TCL procedures and scripts exit, either successfully or unsuccessfully.

KEYWORDS

remove, variable

Copyright © 1993 The Regents of the University of California.Copyright © 1994-1996 Sun Microsystems, Inc.Copyright © 1995-1997 Roger E. Critchlow Jr.