This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFA: ensure binary objects opened in binary mode
On Wed, Feb 22, 2006 at 08:34:54PM +0200, Eli Zaretskii wrote:
> > (1) for every file that #includes both defs.h AND <fcntl.h>, remove the
> > <fcntl.h> inclusion.
>
> I'm not sure this is a good idea. What if tomorrow we remove fcntl.h
> from defs.h--do we go through all these files again and add it back?
> Why bother? fcntl.h should be idempotent, so including it several
> times does no real harm.
>
> I actually quite dislike source files that don't include standard
> headers because they are included in defs.h and its ilk. It makes me
> wonder how come foo.c uses something defined in bar.h, but there's no
> "#include <bar.h>" anywhere in sight.
I'm indifferent. We can't rely on these extra includes being present,
since the compiler won't check for them, but I agree that they're
clarifying. I don't see a reason to bother to remove them.
> So I'd prefer if you committed the 1st and the 3rd patch. but not the
> second. However, before you actually do that, let's wait and hear
> what others think.
Fine by me.
> > +/* In case this is not defined in fcntl.h */
> > +
> > +#ifndef O_BINARY
> > +#define O_BINARY 0
> > +#endif
>
> I'd change the comment to explain that O_BINARY has a meaning on
> non-Posix platforms, while on Posix platforms it should be a no-op.
> That is the _real_ reason we define O_BINARY.
Ditto.
--
Daniel Jacobowitz
CodeSourcery