Skip to Content.
Sympa Menu

freetds - Re: [freetds] [PATCH] VMS build update

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Craig A. Berry" <craigberry AT mac.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] [PATCH] VMS build update
  • Date: Sat, 06 Nov 2004 16:48:40 -0600

James K. Lowden wrote:
- if (freopen(options.input_filename, "r", stdin) < 0) {
+ if ((int)freopen(options.input_filename, "r", stdin) < 0) {

Could I change all these to:

if (freopen(options.input_filename, "r", stdin) < (FILE*)0) {

I think that's more honest.

It looks like the compiler will take that, though it surprises me that
it doesn't complain about comparing zero to an unsigned value. A pointer
can't be negative can it?

BTW, does "< NULL" work better?

No, it doesn't like that:

if (freopen(options.output_filename, "w", stdout) < NULL) {
....................^
%CC-W-CVTDIFTYPES, In this statement, "((void ...)0)" of type "pointer to void", is being converted to "pointer to pointer to struct _iobuf".

Similarly,
- if (options.verbose < 0) {
+ if ((int)options.verbose < 0) {

oughta be

if (options.verbose < (FILE*)0) {

The compiler takes this without complaint.

HOWEVER, as I belatedly look at the docs, my CRTL documentation and C99
agree that fopen and freopen both return NULL on failure, not a negative
number. So apparently what we really should be discussing is changing
them all to "== (FILE*)NULL".




Archive powered by MHonArc 2.6.24.

Top of Page