2005-04-09 01:09:39

by Benoit Boissinot

[permalink] [raw]
Subject: const qualifiers on function returns type

Hi,

there are some function who are declared this way:

include/linux/cpuset.h:21
extern const cpumask_t cpuset_cpus_allowed(const struct task_struct *p);

I was wondering what means const for a function returns type.
K&R doesn't say anything about this and gcc-4 warns (warning: type
qualifiers ignored on function return type)

If it is a mistake, there are a few functions who should be modified.

Regards,

Benoit


2005-04-09 02:42:52

by Bodo Eggert

[permalink] [raw]
Subject: Re: const qualifiers on function returns type

Benoit Boissinot <[email protected]> wrote:

> extern const cpumask_t cpuset_cpus_allowed(const struct task_struct *p);
>
> I was wondering what means const for a function returns type.
> K&R doesn't say anything about this and gcc-4 warns (warning: type
> qualifiers ignored on function return type)

It used to be a hint that the function has no side effect nor depends on
any variable besides the parameters. Calls to those functions may be cached
or omitted.
--
Fun things to slip into your budget
Paradigm pro-activator (a whole pack)
(you mean beer?)