What does the PACKED keyword mean in Android aosp?

  android, android-source, build, c++

When I read some C++ code in the Android aosp, I see some classes are declared with a PACKED keyword. For example, in <android_source_root>/art/runtime/image.h, a class ImageSection is declared this way:

class PACKED(4) ImageSection {
 public:
  ImageSection() : offset_(0), size_(0) { }
  ImageSection(uint32_t offset, uint32_t size) : offset_(offset), size_(size) { }
  ImageSection(const ImageSection& section) = default;
  ImageSection& operator=(const ImageSection& section) = default;

What does the PACKED(4) mean?

Source: Windows Questions C++

LEAVE A COMMENT