Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Yet another GCC question

Author: Heiner Marxen

Date: 08:03:27 12/06/03

Go up one level in this thread


On December 05, 2003 at 21:57:30, Dann Corbit wrote:

>On December 05, 2003 at 21:53:45, Russell Reagan wrote:
>
>>On December 05, 2003 at 21:24:19, Robert Hyatt wrote:
>>
>>>struct BOOK_POSITION {
>>>  long long signature;
>>>  unsigned int status;
>>>  float learn;
>>>  int CAP;
>>>}
>>
>>This also works:
>>
>>struct BOOK_POSITION
>>{
>>  long long signature  __attribute__ ((packed));
>>  unsigned int status  __attribute__ ((packed));
>>  float learn          __attribute__ ((packed));
>>  int CAP              __attribute__ ((packed));
>>};
>
>Neither works unless you use GCC.
>And __attribute__ ((packed)) is one of those bletcherous GCC hacks that makes me
>want to puke.  They should have used a pragma, so you could at least _COMPILE_
>it on some other compiler.  It now becomes toxic to the Intel compiler and the
>Microsoft compiler and the SAS compiler and the DEC compiler, etc.

(Pragmas also have problems.)

I do it this way:

#if defined(__GNUC__)
# define Apacked	__attribute__ ((packed))
#else
# define Apacked	/*empty*/
#endif

And then:
  long long signature  Apacked;

That is portable enough for me, and not ugly enough to avoid it.
YMMV.

>FCOL.

?? are to explain "FCOL" ?

Cheers,
Heiner



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.