Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!think.com!compass!worley From: worley@compass.com (Dale Worley) Newsgroups: comp.lang.c Subject: Re: Is this a valid ANSI program? Message-ID: Date: 27 Jun 91 14:57:40 GMT References: <609@mtndew.Tustin.CA.US> <1991Jun26.232121.29755@watmath.waterloo.edu> Sender: root@compass.com Organization: Compass, Inc., Wakefield, MA, U.S.A. Lines: 27 In-reply-to: datangua@watmath.waterloo.edu's message of 26 Jun 91 23:21:21 GMT In article <1991Jun26.232121.29755@watmath.waterloo.edu> datangua@watmath.waterloo.edu (David Tanguay) writes: > [Essentially, assigning a (char **) value to a (const char **) > variable.] I don't believe it, either. In 3.3.16.1, Simple Assignment, Constraints: both operands are pointers to qualified of unqualified versions of compatible types, and the type pointed to by the left has all the qualifications of the type pointed to by the right Your code satisfies this constraint (the others don't pertain to the example). If you remove one level of indirection, you have a very common situation, with the way the library routines are declared. E.g., int printf( const char *, ... ) Strange as it may seem, that's not true. If you assign A = (char *) to B = (const char *), then A and B are pointers to qualified versions of compatible types (char / const char). However, in the case of A = (char **) and B = (const char **), A is a pointer to (char *) and B is a pointer to (const char *), which are *not* compatible. Remember, (const char *) is not the const-qualified version of (char *), (char * const) is. Dale Worley Compass, Inc. worley@compass.com -- It's getting so the only place you can find a Communist is in an American university.