Monday, June 24, 2013

Array Size

Newsgroup: comp.lang.c++

Subject: Re: Array Size

From: Juha Nieminen <nospam@...>

Date: Mon, 24 Jun 2013 07:30:47 +0000 (UTC)



Scott Lurndal <scott@...> wrote:

> And I disagree with the 'avoid unsigned types'. Use the type that's

> appropriate for the problem. The vast majority of types I use in

> my current projects are unsigned (uint32_t, uint64_t).



That principle has bitten me more than once.



For example in the past I adhered strictly to the convention of

"if negative values make no sense for an integral type, use an unsigned

type instead." Thus, for example, I used unsigned types to denote the

dimensions of an image or the screen.



And then I found myself writing things like this:



double destX = x + screenWidth / 2;



and wondering why it's not working properly.



--- news://freenews.netfront.net/ - complaints: news@... ---







via Usenet Forums - Usenet Search,Free Usenet - comp.lang.c++ http://www.pocketbinaries.com/usenet-forums/showthread.php?26289-Array-Size&goto=newpost

View all the progranning help forums at:

http://www.pocketbinaries.com/usenet-forums/forumdisplay.php?128-Coding-forums

No comments:

Post a Comment