[Patch, libgfortran] Add const restrict to intrinsic functions
Janne Blomqvist
jblomqvi@cc.hut.fi
Sat Nov 26 15:40:00 GMT 2005
On Sat, Nov 26, 2005 at 03:57:16PM +0100, Thomas Koenig wrote:
> On Sat, Nov 26, 2005 at 02:58:30PM +0200, Janne Blomqvist wrote:
> > Hi,
> >
> > the attached patch adds const restrict to the arguments for the
> > intrinsic functions in the m4/ directory.
>
> I believe this is incorrect for cases like eoshift1, which has:
>
> if (ret->data == NULL)
> {
> int i;
>
> ret->data = internal_malloc_size (size * size0 ((array_t *)array));
> ret->offset = 0;
> ret->dtype = array->dtype;
>
> You can't declare ret as "const" in this case.
I think I can, since when the "const" is after the "*" it applies to
the pointer itself, not whatever the pointer points to.
And yes, it doesn't really matter outside the function, since C
argument passing is passing a copy of the pointer. So in this case
"const" is just a reminder for the libgfortran programmer not to go
and mess with the pointer since that will almost certainly mess stuff
up.
--
Janne Blomqvist
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20051126/9b3c5991/attachment.sig>
More information about the Fortran
mailing list