Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: C++ standard question

Author: Mario Antonio F.

Date: 14:27:05 08/29/05

Go up one level in this thread


Another way to bypass the compiler issue is to change the signature of the
get_data function like this:

volatile data_t &get_data(int i)
{
    return globalpointer->bigstruct.datalist[i];
}

Actually, this method should be faster since no temporary objects are created
and passed around. It just depends how you use the function.

Best,

Mario Antonio


On August 29, 2005 at 16:44:15, Mario Antonio F. wrote:

>g++ needs help in order to convert a volatile data_t object into a data_t
>object.
>
>Try
>
>typedef struct basedata {
>    int a;
>    int b;
>    basedata(void) : a(0), b(0) {};
>    basedata(const basedata &bd) : a(bd.a), b(bd.b) {};
>    basedata(volatile basedata &bd) : a(bd.a), b(bd.b) {};
>} data_t;
>
>That should be able to work for you.
>
>Mario Antonio
>
>
>On August 29, 2005 at 16:15:30, Gian-Carlo Pascutto wrote:
>
>>typedef struct {
>>    int a;
>>    int b;
>>} data_t;
>>
>>typedef struct
>>{
>>    volatile data_t datalist[CONSTANT];
>>}
>>bigstruct_t;
>>
>>data_t get_data(int i)
>>{
>>    return globalpointer->bigstruct.datalist[i];
>>}
>>
>>Apparently GNU C++ refuses to compile this in C++ mode (works fine when
>>compiling as C code). Any proposed fixes?
>>
>>a.c: In function `data_s get_data(int)':
>>a.c:443: error: no matching function for call to `data_s::._47(volatile
>>   data_s&)'
>>b.h:133: error: candidates are: data_s::._47(const data_s&)
>>
>>--
>>GCP



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.