[argyllcms] Re: "Development in progress" 2nd update

Graeme Gill wrote:
Gerhard Fuernkranz wrote:

I guess, the new unstructured dump format for CLUT tables isn't really desired, is it? ;-)

I'm not very impressed by the warnings out of VC++ /W4. It objected to this:

    unsigned int count = 4;
    int j;
    for (j = 0; j < count; j++)
        do stuff

because j and count are a signed/unsigned mismatch
but not this

    unsigned int count = 4;
    unsigned int j;
    for (j = count-1; j >= 0; j--)
        do stuff

in which j >= 0 is always true.
gcc didn't notice it always true either.

At least my version of gcc seems to notice that. The following code

   extern void do_stuff(void);

   void func(void)
   {
       unsigned int count = 4;
       unsigned int j;
       for (j = count-1; j >= 0; j--)
           do_stuff ();
   }


results in

           .file   "y.c"
           .text
           .p2align 4,,15
   .globl func
           .type   func, @function
   func:
           pushl   %ebp
           movl    %esp, %ebp
           pushl   %eax
           pushl   %eax
   .L2:
           call    do_stuff
           call    do_stuff
           jmp     .L2
           .size   func, .-func
           .ident  "GCC: (GNU) 4.0.2 20050901 (prerelease) (SUSE Linux)"
           .section        .note.GNU-stack,"",@progbits


i.e. it correctly creates an unconditional, endless loop from the C code.

(and it even does unroll one iteration of the the endless loop; whether this makes sense in this partucular case it a different issue).

Or did you probably expect warnings? :-)
But then any desired endless loop like while (1) { ... } would result in warnings too ...


Regards,
Gerhard


Other related posts: