Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ptsfa!ames!sri-spam!rutgers!seismo!mcnc!rti!xyzzy!meissner From: meissner@xyzzy.UUCP Newsgroups: comp.lang.c Subject: Re: Function prototypes: const parameters Message-ID: <132@xyzzy.UUCP> Date: Tue, 7-Jul-87 13:15:17 EDT Article-I.D.: xyzzy.132 Posted: Tue Jul 7 13:15:17 1987 Date-Received: Thu, 9-Jul-87 06:24:25 EDT References: <18346@ucbvax.BERKELEY.EDU> <8042@utzoo.UUCP> <2210@hoptoad.uucp> <1261@apple.UUCP> <7316@mimsy.UUCP> Reply-To: meissner@xyzzy.UUCP (Michael Meissner) Organization: Data General (Languages @ Research Triangle Park, NC.) Lines: 17 In article <7316@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: /* stuff about mktemp being called with a const char * might give a */ /* compiler warning deleted. */ > This means that on systems on which the compiler will indeed complain > about such usages, header files must mark all those functions that do > not modify objects: > > char *strcpy(char *dst, const char *src); > int sprintf(char *buf, const char *fmt, ...); Another reason to declare prototype parameters as const* instead of * is to tell smart optimizers that the item being passed will not be modified, and thus allowing the optimizer to make less pessimistic assumptions about variable lifetimes. -- Michael Meissner, Data General. Uucp: ...!mcnc!rti!xyzzy!meissner