Click here to Skip to main content
15,882,114 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How can I get current "pragma pack" programatically?
Posted

You can't. #pragmas are compiler directives and used internally by the C/C++ compiler, there is nothing in the object code to identify how they have been used.
 
Share this answer
 
Comments
Lakamraju Raghuram 25-Jan-12 11:53am    
Hmmm.... If you check the link provided by me, there is a way. But I am not sure if the OP wants it in that way. I have coded as said in that article and the value is in fact coming as warning in output window in VS

"warning C4810: value of pragma pack(show) == 4"

I have used #pragma pack(4) earlier
Richard MacCutchan 25-Jan-12 12:25pm    
It is still only available during the compilation phase so I think my answer stands. Of course, the question is so vague (like so many here) that it is almost unanswerable, I don't really know what the OP wants to know or why.
Lakamraju Raghuram 25-Jan-12 12:32pm    
Yup. You have a point. A 5 for your solution
Sergey Alexandrovich Kryukov 25-Jan-12 17:07pm    
Agree, a 5.
--SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900