[cvs] bogofilter/src mime.c,1.33,1.34
Evgeny Kotsuba
evgen at shatura.laser.ru
Mon Jan 3 23:34:14 CET 2005
Hi,
Matthias Andree wrote:
>relson at users.sourceforge.net writes:
>
>
>>+ const size_t l = sizeof("Content-Transfer-Encoding:") - 1;
>>
>>
>
>OK, this is correct but I still don't like it.
>
>Compilers IMO are supposed to evaluate all constant expressions at
>compile time - GCC 3.3 and ICC 8.1 certainly are:
>
>
but calls are not supposed to be inlined for all function calls
>$ cat test.c
>unsigned f() {
> unsigned l = strlen("test string");
> return l;
>}
>$ gcc -fomit-frame-pointer -O -c test.c
>$ objdump -d test.o
>[...]
>00000000 <f>:
> 0: b8 0b 00 00 00 mov $0xb,%eax
> 5: c3 ret
>
>ICC generates the same with two additional "nop" (0x90) pad bytes.
>
>
Can you guarantee that this will have place with more complex function
and source file ? And using sizeof for character constant string is
general practics.... say base64.c uses sizeof
SY,
EK
More information about the bogofilter-dev
mailing list