This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
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
Attachment:
pgp00000.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |