httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: [PATCH] mod_status warnings
Date Sat, 10 Jan 1998 19:43:52 GMT
I want to mention that I don't like the Microsoft C compiler warnings that
are causing these casts to be added left and right.  I certainly won't
sanction casts that "fix" the mod_include and regex warnings.  Those are
warnings caused by C constructs like:

    char *dest;
    char *d;
    size_t len;

    d = dest;
    ... do something with d, d >= dest is an invariant ...
    if (d - dest >= len) break;

That last line is causing warnings on the msc compiler.  I say it's a
load of crap.  Adding a cast to that line (or lines like it) can quite
easily cause problems in the future.  Now if only I could find the
beautiful example of a cast gone awry I had a few months ago, I think
I posted it here.  I'll dig.

I would be 100% happier if that warning was disabled and these "problems"
ignored.  These changes Marc is proposing aren't increasing the quality
of the code, they're restating exactly what the C type rules require.
But once the cast is there, it doesn't matter what the quantity on
the RHS ever becomes, because the compiler is being told to ignore any
potentially wrong things about it.

Dean

On Fri, 9 Jan 1998, Marc Slemko wrote:

> Index: mod_status.c
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/modules/standard/mod_status.c,v
> retrieving revision 1.70
> diff -u -r1.70 mod_status.c
> --- mod_status.c	1998/01/07 16:46:57	1.70
> +++ mod_status.c	1998/01/10 04:44:30
> @@ -364,12 +364,14 @@
>  		    (float) count / (float) up_time);
>  
>  	if (up_time > 0) {
> -	    format_byte_out(r, KBYTE * (float) kbcount / (float) up_time);
> +	    format_byte_out(r, (unsigned long) 
> +               (KBYTE * (float) kbcount / (float) up_time));
>  	    rputs("/second - ", r);
>  	}
>  
>  	if (count > 0) {
> -	    format_byte_out(r, KBYTE * (float) kbcount / (float) count);
> +	    format_byte_out(r, (unsigned long) 
> +                (KBYTE * (float) kbcount / (float) count));
>  	    rputs("/request", r);
>  	}
>  
> 
> 


Mime
View raw message