Path: utzoo!attcan!uunet!lll-winken!pacbell!att!ihnp4!ihlpf!nevin1 From: nevin1@ihlpf.ATT.COM (00704a-Liber) Newsgroups: comp.lang.c Subject: Re: #pragma does only half the job (was Re: Pragma and noalias) Keywords: Pragma Message-ID: <5240@ihlpf.ATT.COM> Date: 8 Jul 88 01:21:41 GMT References: <381@proxftl.UUCP> <8176@brl-smoke.ARPA> <423@proxftl.UUCP> Reply-To: nevin1@ihlpf.UUCP (00704a-Liber,N.J.) Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 42 In article <423@proxftl.UUCP> bill@proxftl.UUCP (T. William Wells) writes: >This would mean that writing strcpy as: > > char * > strcpy(p1, p2) > char *p1; > char *p2; > #pragma noalias p1[],p2[]; > { > ... > } > >is ok, because, given that the assertion (that p1 and p2 are not >aliased) is true, should the compiler make that assumption, the >program will be still correct. But, as Dennis Ritchie pointed out in his 'noalias must go' declaration (BTW, I kept a copy of it and I have been emailing it to all those who have requested it): | A substantial fraction of the library cannot be | expressed in the proposed language. | | One of the simplest routines, | | char *strchr(const noalias char *s, int c); | | can return its first parameter. This first parameter must | be declared with `const noalias;' otherwise, it would be | illegal (by the constraints on assignment, 3.3.16.1) to pass | the address of a const or noalias object. That is, the type | qualifiers in the prototype are not merely an optional | pleasantry of the interface; they are required, if one is to | pass some kinds of data to this or most other library routines. Specfically, in your example, strcpy() returns an ALIAS to p1, which by the definition of noalias is not allowed. -- _ __ NEVIN J. LIBER ..!ihnp4!ihlpf!nevin1 (312) 510-6194 ' ) ) You are in a little twisting maze of / / _ , __o ____ email paths, all different. / (_