Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #10785

Re: sizeof class

From Markus Wichmann <nullplan@gmx.net>
Newsgroups comp.lang.c++
Subject Re: sizeof class
Date 2011-10-10 22:48 +0200
Organization Aioe.org NNTP Server
Message-ID <0a2cm8-3t9.ln1@voyager.wichi.de.vu> (permalink)
References <21470027.1607.1318270963966.JavaMail.geo-discussion-forums@prdw1> <j6vdje$hqj$1@speranza.aioe.org> <30470378.1681.1318274028862.JavaMail.geo-discussion-forums@prmr25>

Show all headers | View raw


On 10.10.2011 21:13, asit wrote:
> Hence the size should be 5 bytes(4 for v-pointer + 1 for char). Then why its is of 8 bytes ?

Can you say padding? The alignment of the structure resulting from the
class definition would be four bytes, but it has a size of five bytes.
To enforce alignment in aggregate types, the size is adjusted to be
divisible by four.

HTH,
Markus

Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

sizeof class asit <lipun4u@gmail.com> - 2011-10-10 11:22 -0700
  Re: sizeof class Gerald Breuer <Gerald.Breuer@googlemail.com> - 2011-10-10 20:30 +0200
    Re: sizeof class asit <lipun4u@gmail.com> - 2011-10-10 12:13 -0700
      Re: sizeof class Ian Collins <ian-news@hotmail.com> - 2011-10-11 08:23 +1300
        Re: sizeof class Victor Bazarov <v.bazarov@comcast.invalid> - 2011-10-10 15:28 -0400
      Re: sizeof class Gerald Breuer <Gerald.Breuer@Use-Author-Supplied-Address.invalid> - 2011-10-10 22:25 +0200
      Re: sizeof class Markus Wichmann <nullplan@gmx.net> - 2011-10-10 22:48 +0200

csiph-web