This is the mail archive of the gcc-bugs@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: More on memcpy() and alignment


> To: gcc-bugs@gcc.gnu.org
> From: Jason Thorpe <thorpej@shagadelic.org>
> Date: Sun, 05 Mar 2000 17:18:39 -0800

> I was just informed that the DEC C compiler will change its behavior
> if the arguments are casted ... e.g. if an argument was casted to
> char *, it would not assume that argument was aligned.

> So, my question now is should GCC change its behavior if the
> argument is casted, like the DEC compiler does?

I must admit, the first thing I did to two and make the code work, was
to cast the value.  Keying off the type to me does seem like a natural
fit.  And, if gives the hardcore programmer specific control over
exactly what the compiler does.  Best of all, it can be hidden in a
regular #define to cast `old' code that may not be safe.  Further, a
cast to a stricter type can also be used in new code that knows it is
safe as a request to generate better code.  So it seems like a win/win
situation to key off type.

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