From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 110292,45b50f14dadfce5b X-Google-Attributes: gid110292,public X-Google-Thread: 102b75,45b50f14dadfce5b X-Google-Attributes: gid102b75,public X-Google-Thread: 1164f8,45b50f14dadfce5b X-Google-Attributes: gid1164f8,public From: harley@pauillac.inria.fr (Robert Harley) Subject: Re: Final kick at the "Merced Guessing Game" Date: 1997/10/02 Message-ID: <610rbh$58f@news-rocq.inria.fr>#1/1 X-Deja-AN: 277367512 Organization: I.N.R.I.A Rocquencourt Newsgroups: comp.sys.intel,comp.arch,comp.sys.dec Nick Maclaren (nmm1@cus.cam.ac.uk) wrote: >harley@pauillac.inria.fr (Robert Harley) writes: >> Nick Maclaren (nmm1@cus.cam.ac.uk) writes: >> >[...] The biggest problem with attempting this is that you can >> >only 'const qualify' at the top level and, for efficient code-generation, >> >you need to do it at other levels. >> >> Huh? What's wrong with 'double const*const*const triMat'? > >How do you get a 'double *** triMat' to that? You have to put a cast in, Well sure, if for some strange reason you wanted to turn a pointer-pointer-pointer into a pointer-pointer, C allows it via a cast. But why on earth would you want to do that? I can only assume that you meant 'double ** triMat' in which case assign it: double const*const*const constTriMat; constTriMat = triMat; or pass it as an argument: double myFunc(double const*const*const bla); myFunc(triMat); or something. Type qualifiers don't affect type compatibility, so it's fine to add a 'const' in this manner. It's also OK discard a 'const' but compilers give a warning if you do so. >which essentially says "don't do ANY checking", [...] Whereas your beloved Fortran checks that the user's assumptions about lack of aliasing are correct, perhaps? >> The object accessed via pointers based on a given restricted pointer >> is only accessed in that way. [...] > >Oh, hell. Well, that's not going to help a lot then, except for the >simplest of cases [...] Huh? -- Rob.