Problem with xstr

Chris Torek chris at mimsy.UUCP
Sat Sep 24 15:17:50 AEST 1988


In article <638 at root44.co.uk> aegl at 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 at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list