Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: shorts

Author: Bruce Moreland

Date: 16:44:59 04/28/00

Go up one level in this thread


On April 28, 2000 at 19:13:33, Will Singleton wrote:

>
>I get compiler warnings about implicit int-to-short conversions, even for a
>statement like
>
>x = -x;
>
>where x is a short.
>
>Is the code doing conversions to int and back to short for that statement?
>
>Will

Don't use the integer data type "short" if you can avoid it.  I know I'm not
answering your question, but if you stop using them, you will have more fun in
the long run.

Sometimes "short" is handled at no additional cost by architectures, but in
other cases, you go much slower if you use this data type.

You should use "int" if you can.  If you need to pack structures or save space
on disk, you can use "short", but you shouldn't do "typedef short SOMETHING" and
declare a whole bunch of automatic variables of type "SOMETHING".

Sorry, I've got the true religion.

bruce




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.