Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What prevents __attribute__((packed)) from getting into ISO C/C++?

This is one of the most important reasons for me to use C/C++ in writing some classes of system software, but it's been nothing more than a compiler extension which happens to be very common. Why isn't the committee considering to support it officially? Was it incompatible with any clauses in the existing spec, such as Does public and private have any influence on the memory layout of an object?

like image 583
nodakai Avatar asked Jul 27 '16 08:07

nodakai


1 Answers

Why isn't the committee considering to support it officially?

Because nobody proposed it. The closest thing to such a proposal was N3986 (PDF), which only works for bitfields. The comments from the discussion suggest that the committee would be interested, but they want to understand what existing practice does before trying to move forward on standardizing it.

Since then, whomever was responsible for that proposal decided not to continue to pursue it.

like image 163
Nicol Bolas Avatar answered Oct 22 '22 22:10

Nicol Bolas