## Tcl9.0.3/Tk9.0.3 Documentation > Tk C API > GetUid

### Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API

### NAME

Tk_GetUid, Tk_Uid — 文字列から紛しくない識別子への変換 convert from string to unique identifier

### SYNOPSIS

#include <tk.h>
Tk_Uid
Tk_GetUid(string)

### 引数 ARGUMENTS

char *string (入力in)
  対応する紛らわしくない識別子が望まれる文字列 String for which the corresponding unique identifier is desired.

### 説明 DESCRIPTION

Tk_GetUid は string.に相当する唯一の識別子を返す｡唯一の識別子は Lisp,の基本子に似ている､又 Tk 内で比較や捜索の速度向上に使われる｡唯一の識別子(Tk_Uid型)は､文字ポインターであり､どこか “char *” 型の変数が使える処で使えるかもしれない｡ しかし､どの与えられた文字列に就いても正確に一つの唯一の識別子である保証がある｡もし Tk_GetUid が二度呼ばれる場合､一度は文字列 a と共に､一度は文字列 b,と共に､且つ a と b が同じ文字列値を有する場合(strcmp(a, b) == 0)､ Tk_GetUid は､それぞれの呼出しについて正確に同じ Tk_Uid 値を返す(Tk_GetUid(a) == Tk_GetUid(b))｡この意味は､あの型 Tk_Uid の変数は strcmp.を呼ぶことなく､直接比較される(x == y)かもしれない｡更に､ Tk_GetUid からの返り値はその引数と同じ文字列値を有する(strcmp(Tk_GetUid(a), a) == 0)｡ Tk_GetUid returns the unique identifier corresponding to string. Unique identifiers are similar to atoms in Lisp, and are used in Tk to speed up comparisons and searches. A unique identifier (type Tk_Uid) is a string pointer and may be used anywhere that a variable of type “char *” could be used. However, there is guaranteed to be exactly one unique identifier for any given string value. If Tk_GetUid is called twice, once with string a and once with string b, and if a and b have the same string value (strcmp(a, b) == 0), then Tk_GetUid will return exactly the same Tk_Uid value for each call (Tk_GetUid(a) == Tk_GetUid(b)). This means that variables of type Tk_Uid may be compared directly (x == y) without having to call strcmp. In addition, the return value from Tk_GetUid will have the same string value as its argument (strcmp(Tk_GetUid(a), a) == 0).

### KEYWORDS

atom, unique identifier
Copyright © 1990 The Regents of the University of California.
Copyright © 1994-1996 Sun Microsystems, Inc.