octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bitshift of int8, int16, etc?


From: John W. Eaton
Subject: Re: bitshift of int8, int16, etc?
Date: Mon, 25 Jun 2007 18:59:22 -0400

On 25-Jun-2007, David Bateman wrote:

| The fact is that as matlab doesn't
| implement this yet, whatever we choose to do will be wrong in any case
| and need modifying in the long run. So simple is probably better..

In that case, the simplest (or at least "safest") thing is probably to
just disable these operations and wait.

But if you want to keep these operators, then I think we should
definitely avoid doing anything where the behavior is dependent on the
implementation of the C compiler.  If you want to try to define and
implement additional behavior that is not defined by the C standard,
then I don't think I can be of much help because I don't normally use
these operators, though I would note that in C++, the program

  #include <iostream>
  int
  main (void)
  {
    unsigned char x = 255;
    std::cerr << (x << 1) << std::endl;
    return 0;
  }

prints 510, but I'm not sure that's a behavior we would want since
other operations on intX types saturate.

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]