Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ucbvax!ucsfcgl!cca.ucsf.edu!rk9005 From: rk9005@cca.ucsf.edu (Roland McGrath) Newsgroups: comp.lang.c Subject: Why not "const char *strerror(int);"?? Message-ID: <1143@ucsfcca.ucsf.edu> Date: 24 Jan 88 22:19:16 GMT Reply-To: roland@rtsg.lbl.gov (Roland McGrath) Organization: Hackers Anonymous International, Ltd., Inc. (Applications welcome) Lines: 18 Well, let's try this again ... Why doesn't the standard declare strerror as const char *strerror(int errnum); and similarly for all functions that return pointers to data the user is not supposed to modify? With a compiler that puts string literals in read-only memory, with sys_errlist (or whatever) defined as: const char *sys_errlist[] = { "Error 0", ... }; if the user tries to modify the string returned by strerror, it might cause some illegal instruction fault or something. Is there any reason why it is declared as "char *"?? -- Roland McGrath UUCP: ...!ucbvax!lbl-rtsg.arpa!roland ARPA: roland@rtsg.lbl.gov