help-cgicc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use Of _setmode()


From: Alexander J. Oss
Subject: Re: Use Of _setmode()
Date: Wed, 20 Feb 2002 21:16:58 -0500

Yes, I wouldn't recommend changing code to support buggy compilers.  Perhaps
a list of known-needed workarounds in the installation instructions?

----- Original Message -----
From: "Stephen F. Booth" <address@hidden>
To: <address@hidden>
Cc: <address@hidden>; <address@hidden>
Sent: Tuesday, February 19, 2002 10:40 PM
Subject: RE: Use Of _setmode()


> Thanks for the BCB bug fixes- I've fixed some (but not all) of the
> problems.  The use of _setmode has been changed to setmode, and I now
> #include <stdio.h> as well.  I have mixed feelings about changing the
> #include of <float.h> to <cfloat>, as well as the implicit type
> conversion bug you mentioned, simply because it annoys me to have
> #ifdefs in my code that are the result of buggy compilers.  So I guess
> I'm undecided on those.  Your thoughts?
>
> -Stephen
>
> > -----Original Message-----
> > From: address@hidden [mailto:address@hidden On
> Behalf
> > Of Edward Diener
> > Sent: Thursday, February 14, 2002 5:40 PM
> > To: address@hidden
> > Subject: Re: Use Of _setmode()
> >
> > Alexander J. Oss wrote:
> >
> > >More Borland C++Builder 5 comments...
> > >
> > >Line 48 of CgiEnvironment.cpp calls the functions _setmode() inside
> an
> > >#ifdef WIN32, and that function (and its parameter _O_BINARY) doesn't
> > exist
> > >for Borland... I assume they are VC++ constructs.  Borland instead
> uses
> > the
> > >same stuff without the underscores.  I replaced the code with the
> > following:
> > >
> > >  // On Win32, use binary read to avoid CRLF conversion
> > >#ifdef WIN32
> > >#ifdef __BORLANDC__
> > >  setmode(_fileno(stdin), O_BINARY);
> > >#else
> > >  _setmode(_fileno(stdin), _O_BINARY);
> > >#endif
> > >#endif
> > >
> > >Note also that Borland's _fileno() requires <stdio.h>, which I added
> in
> > the
> > >#ifdef WIN32 which includes <io.h> and <fcntl.h> on line 34.
> > >
> > I have already mentioned this in a previous post but no one responded.
> > The non-Ansi _fileno is in stdio.h in both the
> > Microsoft Visual C++ compiler and the Borland C++ Builder compiler and
> > therefore stdio.h needs to be included.
> > In the Visual C++ compiler it is included by one of the other header
> > files while in C++ Builder it is not, but this is
> > just an implementation detail and it should be included in
> > CgiEnvironment.cpp. I also made the same change to the source
> > which you did regarding the _setmode call, but this can also been done
> > by defining "_setmode" to "setmode" either in
> > the C++ Builder IDE when building the project or from the command
> line.
> > Nevertheless it should almost certainly be
> > done in the file as you have done above to avoid end users having to
> > know to do it from the outside.
> >
> >
> > _______________________________________________
> > help-cgicc mailing list
> > address@hidden
> > http://mail.gnu.org/mailman/listinfo/help-cgicc
>
>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]