Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!rutgers!mailrus!ncar!tank!oddjob!mimsy!chris
From: chris@mimsy.UUCP (Chris Torek)
Newsgroups: comp.unix.wizards
Subject: Re: Problem with xstr
Message-ID: <13721@mimsy.UUCP>
Date: 24 Sep 88 05:17:50 GMT
References: <4252@thorin.cs.unc.edu> <145@taux02.UUCP> <638@root44.co.uk>
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Lines: 23

In article <638@root44.co.uk> aegl@root.co.uk (Tony Luck) writes:
>Xstr isn't a hack for ... making more room for data. It is a hack to allow
>you to share the strings between executables ....
[second ellipsis mine]

While xtr is *primarily* a hack for sharing strings, it is also a hack
for making more room for data.  In particular, if you have some code
that looks like, e.g.,

	printf("%s %d\n", a, b);
	...
	printf("%d\n", c);

xstr compiles this to

	printf(&xstr[OFFSET], a, b);
	...
	printf(&xstr[OFFSET+3], c);

(where OFFSET is some constant).  Presto, one copy of % d \n \0 deleted!
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris