Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: C++ standard question

Author: Marek Kolacz

Date: 04:05:43 08/30/05

Go up one level in this thread


Hi!

On August 30, 2005 at 05:46:57, Gian-Carlo Pascutto wrote:

>On August 30, 2005 at 03:25:06, Marek Kolacz wrote:
>
>>Hello!
>>
>>Try this:
>>
>>data_t get_data(int i){
>>  return *const_cast<data_t*>(&globalpointer->bigstruct.datalist[i]);
>>}
>>
>>This solution is far from being elegant, but it seems to work with no additional
>>overhead (at least for single thread programs).
>
>This prevents the code from being compiled as C.

This should work in both cases:

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

Wishes,
--
Marek Kolacz



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.