Ben Bacarisse
8/4/2011 1:25:00 PM
Cocon Cocon <comuesli@gmail.com> writes:
> I see what 'const' does to global variables and pointer arguments. But
> how about return types?
>
> Consider:
>
> const int f() {
> ...
> }
>
> What does the 'const' change?
Nothing. const is a property of objects not values and in C functions
return values not objects. That's a simplification -- a more technical
description is that function calls are not lvalue expressions.
> Specifically, what would one have to put in for the '...' in order to
> get a compile-time error?
I'd have thought you would be likely to get a diagnostic just for having
the const there though I don't think the C standard requires one.
--
Ben.