This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH s/bzero/memset/


Jeffrey A Law wrote:
> 
>   In message <37D61B79.108E95B8@pobox.com>you write:
>   > Jeffrey A Law wrote:
>   > >
>   > >   In message <37D07C3C.DC474D22@pobox.com>you write:
>   > >   > This is a multi-part message in MIME format.
>   > >   > --------------BE6004DE7E077CC4F5BBA42B
>   > >   > Content-Type: text/plain; charset=us-ascii
>   > >   > Content-Transfer-Encoding: 7bit
>   > >   >
>   > >   > A patch floats by every now and then that replaces bzero with memset,
>   > >   > generally to avoiding casting and make code look better.  I was looki
>   > ng
>   > >   > through alias.c and removed bzero while I did so.  Does this sort of
>   > >   > thing look ok?  no change to make bootstrap after this patch.
>   > > I'm happy with replacing bzero with memset.  Though I am curious why you
>   > > deleted the casts.
>   >
>   > memset is prototyped to take a void* and ANSI C compilers generally
>   > quietly convert any pointer to a void*.  (at least my Mark Williams ANSI
>   > ref thinks so)  Is the lack of a cast non-portable, to K&R compilers
>   > perhaps?
> You're assuming that systems always provide correct prototypes.
> Experience has shown over and over that systems do not ways provide correct
> prototypes.

How to correct this, though?  Cast to 'PTR'?

If prototypes vary then _any_ cast to a standard C type [for the first
arg of memset()] cannot possibly be correct.  

Regards,

	Jeff




-- 
Custom driver development	|    Never worry about theory as long
Open source programming		|    as the machinery does what it's
				|    supposed to do.  -- R. A. Heinlein


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]