[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-3931-g5f08200

Matthieu Suiche msuiche at gmail.com
Tue Sep 2 18:37:27 GMT 2008


Is it because inside print_size(), the function thinks that the
argument is a pointer to "const char lenbuf[4]" ?

On Tue, Sep 2, 2008 at 8:28 PM, Jeremy Allison <jra at samba.org> wrote:
> On Mon, Sep 01, 2008 at 06:50:08AM -0500, Volker Lendecke wrote:
>> The branch, v3-3-test has been updated
>>        via  5f082003bdd0bb06b391cb0dd0cf6287ba3b99c8 (commit)
>>       from  9d6bfc6c216304f31456cf181dc5e23824e2e54f (commit)
>>
>> http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test
>>
>>
>> - Log -----------------------------------------------------------------
>> commit 5f082003bdd0bb06b391cb0dd0cf6287ba3b99c8
>> Author: Volker Lendecke <vl at sernet.de>
>> Date:   Mon Sep 1 13:46:27 2008 +0200
>>
>>     Fix Coverity ID 587
>>
>>     The following test program prints "8" on 64-bit :-)
>>
>>     static void print_size(const char lenbuf[4])
>>     {
>>             printf("sizeof(lenbuf) = %d\n", (int)sizeof(lenbuf));
>>     }
>>     int main(void)
>>     {
>>             const char lenbuf[4];
>>             print_size(lenbuf);
>>             return 0;
>>     }
>>
>>     Jeremy, please check :-)
>>
>>     Volker
>>     (cherry picked from commit 9daea0ccfdda58450be3c9a9a94c016f5900c319)
>
> Wow. The interesting thing is this test also.
>
> static void print_size(const char lenbuf[4])
>    {
>            printf("sizeof(lenbuf) = %d, int = %d\n",
> (int)sizeof(lenbuf), (int)sizeof(int));
>    }
>    int main(void)
>    {
>            const char lenbuf[4];
>            print_size(lenbuf);
>            printf("sizeof(lenbuf) = %d, int = %d\n",
> (int)sizeof(lenbuf), (int)sizeof(int));
>            return 0;
>    }
>
> prints:
>
> sizeof(lenbuf) = 8, int = 4
> sizeof(lenbuf) = 4, int = 4
>
> Great catch !
>
> Jeremy.
>



-- 
Matthieu Suiche


More information about the samba-technical mailing list