This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: Do CO++ signed types have modulo semantics?


On Wed, Jun 29, 2005 at 03:40:11AM -0400, Paul Schlie wrote:
> > Since you made an incorrect analysis, you draw incorrect conclusions.
> 
> - fair enough, however it seems to me that assuming overflow does not occur
> and assuming overflows are trapped are logically equivalent?

No.  Assuming overflows are trapped puts an unnecessary constraint on the
compiler.  It prevents treating integer arithmetic as associative, for
example (as that might introduce a new trap).

> Overall, I guess I still simply believe the the first rule of optimization
> is to preserve existing semantics unless explicitly authorized otherwise,
> and then only if accompanied with corresponding warnings for all potentially
> behavior altering assumptions applied.

But C does not define the semantics of integer overflow, so there are no
existing semantics to preserve.






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