From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Sat, 18 Sep 2010 00:58:14 +0200 Subject: [U-Boot] [PATCH 12/26 v2][NEXT] ARM: add relocation support In-Reply-To: <20100917192222.069D615242D@gemini.denx.de> References: <4C62E8C3.8050006@denx.de> <1284721853-8298-1-git-send-email-hs@denx.de> <1284721853-8298-2-git-send-email-hs@denx.de> <1284721853-8298-3-git-send-email-hs@denx.de> <1284721853-8298-4-git-send-email-hs@denx.de> <1284721853-8298-5-git-send-email-hs@denx.de> <1284721853-8298-6-git-send-email-hs@denx.de> <1284721853-8298-7-git-send-email-hs@denx.de> <1284721853-8298-8-git-send-email-hs@denx.de> <1284721853-8298-9-git-send-email-hs@denx.de> <1284721853-8298-10-git-send-email-hs@denx.de> <1284721853-8298-11-git-send-email-hs@denx.de> <1284721853-8298-12-git-send-email-hs@denx.de> <1284721853-8298-13-git-send-email-hs@denx.de> <4C936823.1060802@free.fr> <20100917145430.4047615242D@gemini.denx.de> <4C939ADD.5090009@free.fr> <20100917192222.069D615242D@gemini.denx.de> Message-ID: <4C93F286.5030404@free.fr> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Le 17/09/2010 21:22, Wolfgang Denk a ?crit : > Dear Albert ARIBAUD, > > In message<4C939ADD.5090009@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.