Boost logo

Ublas :

From: Karl Meerbergen (Karl.Meerbergen_at_[hidden])
Date: 2007-09-19 09:25:52


Most software for scientific programming uses int as size type. It takes
time to adapt to this. Is there an advantage using unsigned int types?
(I use std::size_t most of the time, unless when I link with external
software) Do the advantages justify potential errors that (naive) users
may make? For example, working with banded matrices is sometimes easier
when indices can be negative.

Karl

Hongyu Miao wrote:

>Thanks, Paul. Honestly, I didn't get a chance to read the link in your reply; but thanks very much for making the point clear. I've beening using C/C++ about 9 years; Intel C++, VC++ and GCC are all the compilers I've used. But I'm not a programmer, I just sometimes need to do some programming for scientific problems. Please don't feel sorry for today's programmers, :).
>
>Best,
>------------------
>Hongyu Miao
>2007-09-19
>
>-------------------------------------------------------------
>From:Paul C. Leopardi
>Date:2007-09-18 19:10:44
>To:ublas_at_[hidden]
>CC:
>Subject:Re: [ublas] Bug Report: ublas::matrix
>
>Hello Hongyu Miao,
>On Mon, 17 Sep 2007, Hongyu Miao wrote:
>
>
>>Thanks, Paul. I put a "double" before i*A4.size2() and it did work.
>>However, I declared i and j to be int, not size_type or unsigned int; so
>>the arihmetic conversions should not treat the result as unsigned number,
>>am I right? Thanks again.
>>
>>BTW: I'm using BOOST v1.34.1 and VS 2005 on Windows.
>>
>>
>
>Please read 5.9 again. It says:
>"Then, if either operand is unsigned long the other shall be converted to
>unsigned long."
>
>You have
>i*A4.size2()-j
>
>which is
>(int * unsigned long) - int
>
>which becomes
>unsigned long - int
>
>which becomes
>unsigned long
>
>How long have you been programming in C and C++ and how many other compilers
>have you used?
>Best, Paul
>_______________________________________________
>ublas mailing list
>ublas_at_[hidden]
>http://lists.boost.org/mailman/listinfo.cgi/ublas
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>ublas mailing list
>ublas_at_[hidden]
>http://lists.boost.org/mailman/listinfo.cgi/ublas
>
>