On Fri, Mar 6, 2009 at 2:15 PM, Peter Stuge <[email protected]> wrote:
> Stefan Reinauer wrote:
>> >>> -const uint32_t msraddrbyname(const char *name) {
>> >
>> > That was to get it to compile with -Werror which is on by
>> > default. It didn't look like that really needed to be a const.
>>
>> Does the const make sense at all? It seems odd to define the
>> variable integer return value of a function const. What's that
>> supposed to be good for?
>
> The value returned in the function is const. Is it OK to still have
> the function return non-const?
>
> msrtool.h:
>
> struct msrdef {
>        const uint32_t addr;
>
>
> msrutils.c:
>
> if (addr == m->addr)
>        return m->addr;
> if (!strcasecmp(name, m->symbol))
>        return m->addr;
>
>
> If I just made a too conservative assumption about types, I am all
> for!
>
> Acked-by: Peter Stuge <[email protected]>

Yes, That doesn't seem to bother the type checking but having the
return type not match the variable causes an error (warning).

r3985

Thanks,
Marc

--
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to