This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add wrappers for ExitProcess, TerminateProcess


Dave Korn wrote:

>   Heh.  I see what you did there!

  As to the actual patch itself, it looks sane (just reading it by eye, I
haven't tested it), and the design motivation seems reasonable.

> @@ -136,11 +136,19 @@ status_exit (DWORD x)
>  
>  # define self (*this)
>  void
> +pinfo::set_exit_code (DWORD x)
> +{
> +  extern int sigExeced;
> +  if (x >= 0xc0000000UL)
> +    x = status_exit (x);
> +  self->exitcode = EXITCODE_SET | (sigExeced ?: (x & 0xff) << 8);
> +}
> +
> +void
>  pinfo::maybe_set_exit_code_from_windows ()
>  {
>    DWORD x = 0xdeadbeef;
>    DWORD oexitcode = self->exitcode;
> -  extern int sigExeced;

  File-local extern declarations are pure evil, let alone function-local ones.
 Why not fix this badness while you're touching it anyway?

    cheers,
      DaveK


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]