Zitat von Brad Chamberlain <[email protected]>: > Where some options are: > > a) The compiler should complain that there isn't an appropriate overload > of foo(). I.e., coercions from int(32) to real(32) are lossy, so > should not happen automatically. > > b) The int(32) is coerced to a real(32) and foo() is called > > c) Same as (b), but a compile-time warning is also generated warning of > the potential for loss of data. > > Again, we're curious for thoughts on this question. >
I would prefer option c) for avoiding unwanted effects. C/C++ usually does option b) (at least GCC and G++) and this is a common source of runtime-errors for beginners or for people who program too fastly. ;) b) may have an educational use but in practice I don't find this appropriate. There may be seldom cases where this situation appears intentionally so I'm not favor of a) which has been suggested before. But this depends on Chapel's philosophy about how much freedom to give to the programmer. bye ------------------------------------------------------------------------------ _______________________________________________ Chapel-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/chapel-users
