Hi,

On Sun, May 22, 2016 at 11:00:22AM -0400, Selva Nair wrote:
> > On Sun, May 22, 2016 at 12:46:27AM -0400, Selva Nair wrote:
> > >          {
> > >            size += 10;
> > > -          handles = realloc (handles, size * sizeof (HANDLE));
> > > -          if (handles == NULL)
> > > -            return ERROR_OUTOFMEMORY;
> > > +          LPHANDLE tmp = realloc (handles, size * sizeof (HANDLE));
> > > +          if (tmp == NULL)
> >
> > ... oh, and this might actually fail MSVC compilation, due to
> > "variable declared after other code parts" (size += 10)...
> 
> Isn't it time to deprecate support for visual studio older than 2013? MSVC
> in VS-2015 supports C99 constructs and VS2013 may also do.
> 
> If not, I'll submit a version 2.

Dunno... the only time I compiled on windows, I was using mingw+msys... but
since I get yelled at if we break MSVC compatibility, I started to look
out for such constructs.

Lev, what are you compiling with?

[..]
> > So we do not exit anymore when this fails, except if WAIT_FAILED?
> 
> That is correct.  I tested it and works nicely -- i.e., on realloc error,
> all previous connections continue while new connections get an error
> message.

This is very nice indeed!

(Not that a realloc() failure for +40 bytes would ever happen on its
own - if memory is that tight, other stuff will explode as well :-) - but
I really really like such defensive code that just works with what it
has, instead of "oh, panic, just crash")


Mmmh, anyway, I have two options now :-) - ask you for a v2 that is
MSVC 2010 compatible, and has the initial value reverted to "10", or
just apply...

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             g...@greenie.muc.de
fax: +49-89-35655025                        g...@net.informatik.tu-muenchen.de

Attachment: signature.asc
Description: PGP signature

Reply via email to