$Id: CodeStyle,v 1.3 1995/03/28 14:24:46 drd Exp $

The following things have be observed when writing new code for gnuplot:
(this file is currently under construction)

The following functions may not be used, since they are not present on all
systems (though the substitute functions might be defined to exactly these
functions)

function	use instead

bcopy		memcpy
bzero		memset
index		strchr
rindex		strrchr
strncasecmp	strnicmp


To make the code compilable on pre-ANSI style compilers, no ANSI style function
definitions can be used. Prototypes have to be enclosed in a special macro,
e.g.

int strcmp __P((char *s, char *t)); /* note the double ()'s */

If a function has an argument which has a default promotion (char, short,
float), this could cause problems with some strict ANSI conforming compilers.
In this case an alternate function header must be used, e.g.

#ifdef ANSI_C
char *foo(char s)
#else
char *foo(s)
char s;
#endif

but since there's no benefit from using a character as parameter, may
as well use the int  (?)


Large integer constant expression have to be explicitly cast to long, even
if the result is assigned to a long variable.

long t=60*60*24;
results in a overflow on 16 bit compilers, even though the result fits into
the long variable.

Correct: long t=60l*60l*24l;


While ANSI compilers can use prototypes for implicit typecasts, k&r
compilers do not have this information. Avoid relying on implicit
conversions of function parameters.


Please avoid duplicating large sections of code - make the effort
to make a function or macro out of the common code.

[more to come]
