[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnuplot-info-beta
Subject:    Re: PostScript prologue
From:       Hans-Bernhard Broeker <broeker () physik ! rwth-aachen ! de>
Date:       2004-03-01 12:46:37
[Download RAW message or body]

On Mon, 1 Mar 2004, Dave Denholm wrote:

> Aren't string literals merely a convenience feature. You can implement
> things explicitly as
> 
> static const char label1[] = "hello world\n";

Sure.  The core problem is with large arrays of string literals...
Technically, that makes them 2D arrays, and for those, you can't
have the "inner" dimension (i.e. the lengths of individual strings)
variable.  That would mean we either

	static const char PS_header[][60] = {
	   "line 1\n",
	   "line2\n",
	   /*... */
	};

and waste even more space than we currently do, because of variations in
line lengths, or declare each line as an individual, named string
variable, and construct the array from pointers to those strings:

	static const char line1[]="line1\n";
	static const char line2[]="line2\n";
	/*...*/

	static const char *PS_header[] = {
	   line1,
	   line2,
	   /* ... */
	};

The problem at hand is not with string literals as such, but with large
collections of them, and with keeping the source code at least barely
legible and extensible.

-- 
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic