[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers |
Date: |
Thu, 28 Aug 2008 09:11:07 +0200 |
> >>>From what he said, it does support structure packing, but still
> includes
> > padding for alignment at the end.
>
> I believe that is not a bug, on the contrary it looks like a bug-fixing.
> Let me explain: I use OpenWatcom and the new versions have the padding,
> the very old don't. I believe it is because of the array problem that
> has alredy been explained...
The array problem that has already been explained exists to make sure the
following structs are aligned correctly. However, since alignment is
effectively switched off with packing, this can't be the reason!
>
> > I agree that no structure packing at all would not be worth attempting
> to
> > support.
>
> I agree too. Not to use packing would make the code bigger and all
> compilers have packing, it just a problem of syntax.
In contrast, for most processors, the code gets bigger with structure packing!
This is because the compiler doesn't know where e.g. (for a 32-bit processor)
an U32 will be so it has to load every byte of it as a single load and combine
the 4 bytes in one register. Compared to one single load instruction for a
correctly aligned U32, this is much bigger!
In lwIP, the reason for structure packing is that the network protocols are
always 'packed' (i.e. without alignment) since every platform has its own
alignemt constraints -> can't be fulfilled by a generic protocol. And this is
also the reason why every compiler using lwIP _has to support_ structure
packing!
>
> IMHP the appropriate pack/unpack files of each compiler should be
> included somewhere, so that any new user can use it :)
Included in the lwIP distro? I don't think so: Compilers often change and we
can't keep a list of all the compilers in the world. It's up to the one that
ports lwIP to a specific platform to define the correct structure packing
macros/files.
Simon
--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/address@hidden
- [lwip-users] Problem With dns.c Using 32-Bit Compilers, Nick Thomas, 2008/08/27
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Jonathan Larmour, 2008/08/27
- RE: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Nick Thomas, 2008/08/27
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Marek Matej, 2008/08/27
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Jonathan Larmour, 2008/08/27
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, address@hidden, 2008/08/27
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Jonathan Larmour, 2008/08/27
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Alain M., 2008/08/27
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers,
Simon Goldschmidt <=
- RE: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Bill Auerbach, 2008/08/28
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Alain M., 2008/08/28
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Michael Williamson, 2008/08/28
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, address@hidden, 2008/08/28
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Michael Williamson, 2008/08/28
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Alain M., 2008/08/28
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Jonathan Larmour, 2008/08/28
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Alain M., 2008/08/28
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Jonathan Larmour, 2008/08/28
- Re: [lwip-users] Problem With dns.c Using 32-Bit Compilers, Alain M., 2008/08/28