Path: utzoo!utgpu!water!watmath!clyde!rutgers!sri-spam!sri-unix!quintus!sun!pitstop!sundc!seismo!uunet!sdrc!scjones From: scjones@sdrc.UUCP (Larry Jones) Newsgroups: comp.lang.c Subject: Re: "Noalias" warning and questions Summary: No problems here ... Message-ID: <213@sdrc.UUCP> Date: 12 Feb 88 23:06:34 GMT References: <8012@elsie.UUCP> Organization: Structural Dynamics Research Corp., Cincinnati Lines: 36 In article <8012@elsie.UUCP>, ado@elsie.UUCP (Arthur David Olson) writes: < [stuff about noalias] < < Now a bit of background for a few questions. Here are two function prototypes < from the proposed Standard: < int strcmp(const noalias char *s1, const noalias char *s2); < void perror(const noalias char *s); < < 1. Does the program < #include "stdlib.h" < main() { < char array[3]; < array[0] = '\0'; < return strcmp(array, array); < } < violate any constraints? If so, must the compiler detect the violation? < < [other similar examples] Nope, no problems here. The definition of noalias doesn't forbid aliases, it just says that if you do have aliases and >modify< one of them, all bets are off. Since strcmp() doesn't modify any of its arguments (as evidenced by the "const"), your examples are all fine and dandy. < 4. What is the "noalias" in the "perror" declaration designed to do? The same thing as it does in the "strcmp" declaration - basically nothing. It's really only applicable to output arguments but we decided to put it on all the library pointers for consistency's sake. -- ---- Larry Jones UUCP: uunet!sdrc!scjones SDRC MAIL: 2000 Eastman Dr., Milford, OH 45150 AT&T: (513) 576-2070 "When all else fails, read the directions."