[Unison-hackers] build errors on FreeBSD

Max Bowsher maxb at ukf.net
Mon Aug 29 12:35:05 EDT 2005


Trevor Jim wrote:
> On Aug 27, 2005, at 10:20 AM, Dan Pelleg wrote:
>
>> This can be fixed easily in pty.c:
>>
>> @@ -40,9 +41,10 @@
>>  /* c_openpty: unit -> (int * Unix.file_descr) */
>>  CAMLprim value c_openpty() {
>>    int master,slave;
>> +  value pair;
>>    if (openpty(&master,&slave,NULL,NULL,NULL) < 0)
>>      uerror("openpty", (value) 0);
>> -  value pair = alloc_tuple(2);
>> +  pair = alloc_tuple(2);
>>    Store_field(pair,0,Val_int(master));
>>    Store_field(pair,1,Val_int(slave));
>>    return pair;
>>
>> AFAIK, the original form is not legal C (although it may be legal C+
>> +, and
>> accepted by some compilers).
>
> This is legal C, declarations do not have to be at the
> beginning of functions, I think with C99.

That's true, but C99 is still a relatively new dialect. I think K&R C is 
well and truly dead by now, but the same cannot be said of C89.

It's a pretty small change, and it doesn't make the code much harder to 
read, so I'd suggest applying it, to maintain C89 compat for now.

Max.



More information about the Unison-hackers mailing list