[comp.windows.x] why are Motif constants represented as strings?

tomt@maui.coral.COM (Tom Tulinsky) (06/29/90)

Hope you don't mind my using the bandwidth for this question, but why are the
names of Motif resources and classes #defined to strings instead of integer
constants? Its not a big deal, but it seems like integers would be 
more efficient to compare.  



 Coral
     * **	Tom Tulinsky                508 460-6010
  *  **		Coral Network Corporation   fax 508 481-6258
*  ** 		734 Forest St               net: tomt@coral.com
 ***		   Marlboro, MA 01752		
  **		
*********	
NETWORKS	

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (06/29/90)

> Hope you don't mind my using the bandwidth for this question, but why are the
> names of Motif resources and classes #defined to strings instead of integer
> constants? Its not a big deal, but it seems like integers would be 
> more efficient to compare.  

The names an classes are used, not only in application code, but also for
application customization using the X Resource Manager.  Each widget and widget
resource is identified by both a name and class that are represented as strings.
These string representations allow the widget attributes to be modified by both
the programmer and user, using resource manager.

It turns out that the internal representation of these strings are in what we
call "quarks".  A quark is an integer representation of a string.  This was
implemented to address the problem that you mention of excessive memory
consumption by a database that is accessed through a list of strings.

To avoid a proliferation of interfaces the X Toolkit provides only a string
interface for the XtSetValues.  Since the number of resources an application
sets is small (especially if the application programmer is making proper use of
the resource manager through the app-defaults file), it was felt the memory
savings did not justify another complete set of interfaces.


						Chris D. Peterson     
						MIT X Consortium 

Net:	 kit@expo.lcs.mit.edu
Phone:   (617) 253 - 9608	
Address: MIT - Room NE43-213

ben@hpcvlx.cv.hp.com (Benjamin Ellsworth) (06/30/90)

Because the Xt Intrinsics demand it.  The intrinsics need them because
the Xrm stuff (upon which all of the is based) needs strings or their
more compact form (Quarks).

---

Ben