I just checked the reason for un-alignment.  There are number of CHAR16 arrays 
inside my VFR structures to which I need to copy information, like controller 
vendor info etc.  Since they are used in extractconfig calls in constructing 
byte array back using HiiConfigRouting->BlockToConfig,  I must need to keep 
them as byte aligned.

So it looks like I need to manually re-arrange the structures in such a way 
that the CHAR16 arrays are 2 bytes aligned. 

Thanks
Sathya


-----Original Message-----
From: David Woodhouse [mailto:[email protected]] 
Sent: Thursday, February 14, 2013 12:58 AM
To: Andrew Fish
Cc: [email protected]
Subject: Re: [edk2] How to align auto variables?

On Wed, 2013-02-13 at 16:59 -0800, Andrew Fish wrote:
> I think the best solution may be to to have a PCD feature flag to 
> control this feature. If you are constructing code in the edk2 you 
> mostly want it to be generic and we can default to turning it on. If 
> you are construction code with looser rules you can turn it off.

I'm dubious about that idea. It is *often* the case that code one expects *not* 
to have to port, *does* end up being used in situations which weren't 
originally anticipated. Deliberately being lax about one's own code is one 
thing, but for us to implement a generic way to *enable* engineers to be 
deliberately lax about their code is another. That does not sound like a recipe 
for future happiness.

It's not as if writing portable code which obeys the alignment constraints of 
the C language is particularly difficult, surely?

Of course, in this particular case it probably serves us right for using this 
UTF-16 abomination instead of UTF-8... but that's a different story :)

--
dwmw2

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to