Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > pragma Pack vs....
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 13 Topic 5480 of 5931
Post > Topic >>

pragma Pack vs. Convention C, ****tability issue?

by okellogg <okellogg@[EMAIL PROTECTED] > Jan 9, 2008 at 12:40 AM

-- File: main.adb
-- Can we ****tably rely on pragma Pack taking precedence
-- over Convention C?
with Text_IO;

procedure Main is

   type C_Represented_Enum is (Zero, One, Two, Three);
   pragma Convention (C, C_Represented_Enum);
   -- This would be 32 bits on a 32 bit architecture

   type Perhaps_Packed is array (1 .. 4) of C_Represented_Enum;
   pragma Pack (Perhaps_Packed);
   -- This could be either 8 bits if the compiler lets pragma Pack
   -- take precedence over Convention C, or 4 * 32 = 128 bits
   -- otherwise.

begin
   Text_IO.Put_Line
     ("Perhaps_Packed'Size is" &
      Natural'Image (Perhaps_Packed'Size));
end Main;
 




 13 Posts in Topic:
pragma Pack vs. Convention C, portability issue?
okellogg <okellogg@[EM  2008-01-09 00:40:50 
Re: pragma Pack vs. Convention C, portability issue?
Adam Beneschan <adam@[  2008-01-09 08:06:54 
Re: pragma Pack vs. Convention C, portability issue?
Robert A Duff <bobduff  2008-01-09 17:12:35 
Re: pragma Pack vs. Convention C, portability issue?
"Randy Brukardt"  2008-01-10 22:15:05 
Re: pragma Pack vs. Convention C, portability issue?
"Randy Brukardt"  2008-01-11 13:17:42 
Re: pragma Pack vs. Convention C, portability issue?
"Randy Brukardt"  2008-01-10 22:15:05 
Re: pragma Pack vs. Convention C, portability issue?
"Randy Brukardt"  2008-01-10 22:15:05 
Re: pragma Pack vs. Convention C, portability issue?
okellogg <okellogg@[EM  2008-01-09 21:53:29 
Re: pragma Pack vs. Convention C, portability issue?
"Randy Brukardt"  2008-01-10 22:20:37 
Re: pragma Pack vs. Convention C, portability issue?
"(see below)" &  2008-01-11 19:53:05 
Re: pragma Pack vs. Convention C, portability issue?
"Randy Brukardt"  2008-01-11 22:58:47 
Re: pragma Pack vs. Convention C, portability issue?
Robert A Duff <bobduff  2008-01-11 17:46:42 
Re: pragma Pack vs. Convention C, portability issue?
Adam Beneschan <adam@[  2008-01-11 16:35:15 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 11:22:26 CDT 2008.