Author: Sune Fischer
Date: 16:00:04 02/22/03
Go up one level in this thread
On February 22, 2003 at 18:04:23, Uri Blass wrote:
>>>>>
>>>>>I cannot double click on the warning but the line is exactly line 370
>>>>>and here is the content of that line:
>>>>>
>>>>>hash_table = calloc((struct tagHASHE *) TableSize, sizeof( HASHE ));
>>>>>
>>>>>
>>>>
>>>>why you cast it to tagHASHE * ?!
>>>>
>>>>try this:
>>>>hash_table = (HASHE*) calloc(TableSize, sizeof(HASHE));
>>>
>>>Does not help
>>>same warnings:
>>>
>>> warning C4047: 'function' : 'unsigned int ' differs in levels of indirection
>>>from 'struct tagHASHE *'
>>
>>are you sure this is the line you get the warning? what is your hash_table
>>declaration?
>
>typedef struct tagHASHE
>{
> __int64 key;
> unsigned int depth:7;
> unsigned int flags:2;
> signed int value:16;
> move best;
>} HASHE;
>
>for declaration of move I have
>
>typedef struct
>{
> char from;
> char to;
> char promote;
> char bits;
>}
>move_bytes;
>
>typedef union
>{
> move_bytes b;
> int u;
>}
>move;
>>
From the help file:
Example
/* CALLOC.C: This program uses calloc to allocate space for
* 40 long integers. It initializes each element to zero.
*/
#include <stdio.h>
#include <malloc.h>
void main( void )
{
long *buffer;
buffer = (long *)calloc( 40, sizeof( long ) );
if( buffer != NULL )
printf( "Allocated 40 long integers\n" );
else
printf( "Can't allocate memory\n" );
free( buffer );
}
Output
Allocated 40 long integers
---end example-----
So you probably want something like this
tagHASHE *hash_table;
hash_table = (tagHASHE *) calloc( TableSize, sizeof( tagHASHE ));
your HASHE is a variable of type tagHASHE, do you need it?
-S.
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.