[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r40424 - trunk/subversion/libsvn_wc

From: Branko Cibej <brane_at_xbc.nu>
Date: Mon, 09 Nov 2009 03:35:02 +0100

Edmund Wong wrote:
> Neels Janosch Hofmeyr wrote:
>
>> Author: neels
>> Date: Sun Nov 8 13:40:39 2009
>> New Revision: 40424
>>
>>
>
>
>> +static svn_error_t*
>> +get_node_uri(svn_revnum_t *revision,
>> + const char **repos_relpath,
>> + const char **repos_root_url,
>> + svn_wc__db_t *db,
>> + const char *local_abspath,
>> + apr_pool_t *result_pool,
>> + apr_pool_t *scratch_pool)
>> +{
>> + svn_error_t *err;
>> + *revision = SVN_INVALID_REVNUM;
>> + svn_boolean_t do_scan = FALSE;
>> +
>>
>
> Hi Neels,
>
> For some reasons, under VS2008, it's complaining about this last line
> with the following errors:
>
>
> ..\..\..\subversion\libsvn_wc\update_editor.c(1632): error C2275:
> 'svn_boolean_t' : illegal use of this type as an expression
> ..\..\..\subversion\libsvn_wc\update_editor.c(1632): error C2146: syntax
> error: missing ';' before identifier 'do_scan'
> ..\..\..\subversion\libsvn_wc\update_editor.c(1632): error C2065:
> 'do_scan' : undeclared identifier
> ..\..\..\subversion\libsvn_wc\update_editor.c(1651): error C2065:
> 'do_scan' : undeclared identifier
> ..\..\..\subversion\libsvn_wc\update_editor.c(1656): error C2065:
> 'do_scan' : undeclared identifier
>
> I don't understand this at all. Switching the last two statements
> to the following fixes this 'problem' (but still leaves me wondering
> what was wrong with it in the first place'.
>
> > + svn_error_t *err;
> > + svn_boolean_t do_scan = FALSE;
> > + *revision = SVN_INVALID_REVNUM;
>
> I was thinking of doing a patch; but, since I have no understanding
> of WHY it doesn't complain here whereas it complains with the
> initial code, I decided to forgo the patch and see if anyone
> here can explain it.
>

It's quite simple. In the 1990 version of C, unline in C++, you cannot
arbitrarily mix variable declarations and statements; all declarations
must come before the first statement. C99 removes this restriction.
GCC's default is closer to C99. Microsoft's compilers do not support C99
(at all). I'm constantly astounded at how many "C programmers" are not
aware of that.

Our hacking guidelines sort of imply that we're restricted to C90,
though they're not explicit, unfortunately. Should be amended ...

-- Brane

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2415653
Received on 2009-11-09 03:35:23 CET

This is an archived mail posted to the Subversion Dev mailing list.