Thomas Mueller wrote:
Hi Paul,


I don't get it. Why doesn't freebsd like this code?

<code>
void manage_stop_children()
{
       /*
        *
        * cleanup all remaining forked processes
        *
        */
trace(TRACE_MESSAGE, "%s,%s: General stop requested. Killing children.. ",
                       __FILE__,__func__);
       int stillSomeAlive = 1;


It appears gcc on freebsd doesn't like 'int var=0' type declarations inside functions. Or am I missing something else here.


That's not allowed in C, all declarations have to be first.

I'll keep that one in mind.

C++ allows
declarations everywhere. Nevertheless 'declarations first' is a good
idea for better readability ...

Not that I agree with the readability argument though... thinking about some very long functions in imapcommands.c with some pretty obscure variables neatly declared at the beginning, but unused until a few hundred lines below...

When I'm in refactoring mode, extracting to new functions, I move all declarations to where they are first used, and then move the codeblock to a seperate function. I guess doing so a lot lately on the imap code, I got into this habit of keeping declarations neatly together with the code that uses them.

Anyway, hope this fixes it for the freebsd users.

--
  ________________________________________________________________
  Paul Stevens                                         [EMAIL PROTECTED]
  NET FACILITIES GROUP                     GPG/PGP: 1024D/11F8CD31
  The Netherlands_______________________________________www.nfg.nl

Reply via email to