[U-Boot] [PATCH 12/26 v2][NEXT] ARM: add relocation support

Albert ARIBAUD albert.aribaud at free.fr
Sat Sep 18 00:58:14 CEST 2010


Le 17/09/2010 21:22, Wolfgang Denk a écrit :
> Dear Albert ARIBAUD,
>
> In message<4C939ADD.5090009 at free.fr>  you wrote:
>>
>>>>>     init_fnc_t *init_sequence[] = {
>>>>
>>>> init_sequence is a constant, not an initialized variable, and thus
>>>> should have the 'const' qualifier.
>>>
>>> Actually it _is_ an initialized variable (which still may take a
>>> const).
>>
>> Maybe we're having a terminology discrepancy here.
>
> We are talking about C code here, so I apply the terminology of the C
> programming language.

Sorry, but the C terminology as expressed in the C standard *never* 
refers to regions of data storage which hold value as 'variables'; it 
defines them as 'objects' (for instance, see paragraph 3.14 of the C99 
draft widely available; but C89 used the same terminology), and the term 
'variable' appears in it *only* within the expression 'variable length 
array'.

Now granted, I did not use C terminology either. So let's use it: I 
meant to say that the init_sequence object should have a const-qualified 
type. Would you agree?

> The C code line above declares a _variable_ with the name
> "init_sequence" as an array of pointers to objects of type
> init_fnc_t.  C does not have a notation to declare "constants".

Yes it has, it is the type qualifier 'const', which C89, C90 and C99 
define as forbidding writes to an lvalue.

> Even if you add a "const" type qualifier (or two), it's still a
> declaration of a variable.

Not per the standard, I'm afraid. I'll agree it is still the declaration 
of an object.

>> In that sense, and as init_sequence does not, and should not, vary over
>> execution time, it is not a variable.
>
> Indeed, you use a different terminology.
>
> Let's end this discussion here. Please.

As you wish: let us put the temrinology aside.

It remains that whatever name you want to give it, init_sequence is a 
constant object and should be qualified as such.

> Best regards,
>
> Wolfgang Denk

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list