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

Re: Warnings in fs_fs compilation on Win32

From: Branko Čibej <brane_at_xbc.nu>
Date: 2004-06-10 08:13:47 CEST

Greg Hudson wrote:

>On Tue, 2004-06-08 at 21:56, Branko ÄŒibej wrote:
>
>
>>I think the representation size should be an svn_filesize_t, not an
>>unsigned int, especially since it's generated using apr_atoi64 in many
>>places.
>>
>>
>
>It's not an unsigned int, it's an apr_size_t, which varies from platform
>to platform. It's not like there's an ascii to apr_size_t conversion
>function.
>
>
Right, I didn't look at the struct definition, just at the error message.

>But you're right; the size and expanded_size fields of a
>representation_t should be svn_filesize_t's, because of what they
>represent. I will fix, but I can't find a gcc 3.2.3 option to warn
>about implicit type narrowing, so I can't guarantee that I've fixed all
>the warnings.
>
>
That's fine. MSVC will warn about it, so I can fix the remaining ones
once the types are changed. I didn't want to meddle with the FSFS
structures myself.

>>C:\Home\brane\src\svn\repo\subversion\libsvn_fs_fs\fs_fs.c(3604) : warning C4018: '<=' : signed/unsigned mismatch
>>
>>
>>strlen returns a size_t, not an apr_ssize_t.
>>
>>
>
>C is such a bore some times.
>
It is rather, isn't it.

> (int) -1 < (unsigned int) 3 evaluates to
>0. In this case, the signed variable is always positive, of course, but
>I can see why the warning exists.
>
>
Obviously a non-brain-dead compiler should be able to figure that out...

>>Hmm, and I see you're computing 'strlen(PATH_EXT_TXN)' three times in a
>>loop. Premature optimisation may be the root of all evil, but we should
>>at least /look/ like we're trying... :-p
>>
>>
>I can't imagine this would ever cause a perceptible speed difference,
>and therefore I would say it's wrong to compromise the code, even a
>little bit, in the name of saving cycles. But in this case the code
>also looks a little messy as a result of all those strlen() calls, so I
>will change that.
>
>
Yeah, the "messiness" is what caught my eye, too. Heh, GCC 3.3 will
optimize away a strlen on a static string, I believe, replacing it with
a constant. :-)

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jun 10 08:14:31 2004

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.