rgh@inmet.UUCP (11/10/84)
The ANSI C standards committee is addressing library standardization
as well as language issues. To give you the flavor of what's being
discussed, here's the standard header files, and a few sample
declarations in each, from working drafts:
<assert.h>
#define assert(expression) ???
/* complain if expression==0, unless the macro NDEBUG is defined */
<ctype.h>
int isalpha(int);
int tolower(int);
/* etc. */
<math.h>
double sin(double);
/* acos,asin,fmod,log,sqrt,tanh,fabs,etc. */
/* domain or range errors will post EDOM or ERANGE to errno */
/* etc. */
<stdio.h>
FILE * fopen(char *filename, char *mode);
int sscanf(char *buffer, char *format, ...);
/* format characters for printf/scanf/... are defined */
/* defines an l-value errno, which is used for posting error codes */
/* etc. */
<stdlib.h> -- general utility functions
typedef ??? size_type; /* int big enough to hold size of object*/
void *calloc(unsigned int, size_type);
void abort();
int atoi(char *);
void exit(int);
/* etc. */
<setjmp.h>
typedef ??? jmp_buf; /* jmp_buf is an array */
int setjmp(jmp_buf);
void longjmp(jmp_buf,int);
<string.h>
char *strcat(char *, char *);
size_type strlen(char *);
/* etc. */
<time.h>
struct tm {
int tm_sec, tm_min /* , etcetera */ ;
int tm_isdst /* nonzero for daylight savings time */
/* etc. */
}
typedef /*some_int_type*/ time_t;
char * asctime(struct tm *);
struct tm *localtime(time_t *); /* convert to local time */
double difftime(time_t, time_t); /* difference in seconds */
/* etc. */
<vargs.h> -- to handle variable-length argument lists
#define va_list ???
#define va_start(ap, parmN, type) ???
#define va_arg(ap, type) ???
#define va_end(ap) ???
"Unless explicitly stated otherwise, any function or object declared
in a header may be redefined as a macro, within the header ... .
Unless explicitly stated otherwise, any macro ... will expand to
code that evaluates each of its arguments once ... ."
Randy Hudson
{ihnp4,harpo,ima}!inmet!rgh
padpowell@wateng.UUCP (PAD Powell) (11/10/84)
I desperately request the addition of the "snprintf(len,buf,format...)" function to the "stdio.h" family. This is sprintf with buffer checking. I think that sprintf should be DROPPED. Patrick Powell
gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (11/11/84)
> <ctype.h> > int isalpha(int); > int tolower(int); > /* etc. */ I have always thought that there should be a tohostc() macro to convert an ASCII character back to native host character set (converse of toascii()). Also, todigit() to map 3 to '3' and tonumber() to map '3' to 3. In other words, macros to support writing PORTABLE atoi() functions etc.