lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ALLOC_IN_POOL, Re: lynx-dev lynx2.8.5dev.11


From: Leonid Pauzner
Subject: Re: ALLOC_IN_POOL, Re: lynx-dev lynx2.8.5dev.11
Date: Mon, 2 Dec 2002 13:39:39 +0300 (MSK)

2-Dec-2002 05:10 Thomas E. Dickey wrote:
> On Sun, 1 Dec 2002, Bela Lubkin wrote:

Thanks Bela for your analysis!

>> sizeof(void *) on this machine is 4; sizeof(HTStyleChange) is 8.

> right - LP expects too much from the sizeof(void*).

I have expected too much from sizeof(HTStyleChange)...

>> I was surprised to find that the resulting binary didn't coredump.  This
>> is because the previous line (of the word-wrapped macro expansion) says
>> `if ((sizeof (void *) / sizeof (HTStyleChange)))' -- the code that's
>> generating the warning can never actually be reached (on this machine).

...
>> --- GridText.c       Sun Dec  1 18:07:38 2002
>> +++ GridText2.c      Sun Dec  1 23:19:03 2002
>> @@ -158,7 +158,7 @@
>>      unsigned int    direction:2;    /* on or off */
>>      unsigned int    horizpos: (sizeof(short)*CHAR_BIT-2);
                                :14     /*explicitely*/
>>          /* horizontal position of this change */
>> -    unsigned short  style;          /* which style to change to */
>> +    unsigned int    style:16;       /* which style to change to */
>>  } HTStyleChange;
>> Making `style' a like bitfield allows it to share the original unsigned
>> int, bringing the total down to one unsigned int, 4 bytes.  It also
>> incidentally fixes the warnings, since now (sizeof(void *) /
>> sizeof(HTStyleChange)) == 1.

> That's an area where I thought the portability would be strained -
> improvements are welcome, but I'm curious how well it actually does
> on some of the LP64 machines.  I got bogged down trying to see how to
> debug his change for the HTLine's though, and didn't experiment much
> with the struct packing.  It seems to work on Tru64, but not extensively
> tested; otherwise I've only been on Linux & Windows with it.

Sorry, I have not tested my code on any 64bit machine, it was a wild guess...
Somebody interested may improve things.
Perhaps alignment should depend on  if (sizeof(void*) > sizeof(int))
condition (if happen).

Leonid.



; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]