[Klone-users] Re: Merge u_config_save_to_buf() and u_config_print_to_fp() ?

Mickael Auger mickael.auger at gmail.com
Tue Dec 22 02:52:31 EST 2009


Hi Thomas,


> On Dec 21, 2009, at 6:03 PM, Mickael Auger wrote:
>
>> On Dec 21, 2009, at 5:01 PM, Mickael Auger wrote:
>> - the declaration of "int i" should be at the beginning of function in C
>> strict
>>
>> what do you mean exactly by "C strict" ?  As far as I know the code in
>> U_CONFIG_INDENT is ok in ANSI C (and later): the 'i' inside the 'do {...}
>> while (0)' is usually called a block (or local) identifier and its
>> visibility extends from its declaration point inside the block to the end of
>> the same block.  I've not managed to find a K&R-able compiler to test if it
>> works with very old C, but I don't see any problem in principle.  Have you
>> tried with a specific compiler ?
>>
>> I use "m68k-elf-gcc" and I can not compile :
>> =======================
>> #include <stdio.h>
>> int main(int argc, char *argv[])
>> {
>>  printf("coucou\n");
>>  int i;               //--->after
>>  i=5;
>>  return 0;
>> }
>> =======================
>> but I can compile :
>> =======================
>> #include <stdio.h>
>> int main(int argc, char *argv[])
>> {
>>  int i;               //----> before
>>  printf("coucou\n");
>>  i=5;
>>  return 0;
>> }
>> =======================
>> The declaration of "int" (and all declarations) must be the first
>> instruction before other operations.
>> I call it the "C strict" (all declarations before all operations).
>>
>
> yes that's right, but the 'int i;' declaration created by the
> U_CONFIG_INDENT macro is visible only inside the block created by the braces
> in the 'do ... while' loop and does not mess up with the rest of the
> function body.  Could you try this with your gcc 2.95, please:
>
> #include <stdio.h>
> int main (void)
> {
>   printf("coucou\n");
>
>   {
>      int i = 5;
>   }
>
>   return 0;
> }
>
> The compilation of this it's good with gcc and with m68-elf-gcc.

Thank's for your lesson ;)

-- I will sleep less stupid tonight --

-- 
Mickaël AUGER
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://koanlogic.com/pipermail/klone-users/attachments/20091222/6edad9b9/attachment.html


More information about the klone-users mailing list