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


Groups > comp.lang.c > #22867

struct with one member: padding?

From "Mark" <mark_cruzNOTFORSPAM@hotmail.com>
Newsgroups comp.lang.c, comp.unix.programmer
Subject struct with one member: padding?
Date 2012-06-27 12:33 -0400
Organization Aioe.org NNTP Server
Message-ID <jsfckr$drq$1@speranza.aioe.org> (permalink)

Cross-posted to 2 groups.

Show all headers | View raw


Hello

on many (all?) unix implementations IP address structure is designed this 
way:

struct in_addr
  {
     unsigned long s_addr;
  };

Does the Standard allow a C comiler to add padding in such structure? If it 
so, then we have to always 'memset' in_addr to 0 before use.

Thanks.

Mark 

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


Thread

struct with one member: padding? "Mark" <mark_cruzNOTFORSPAM@hotmail.com> - 2012-06-27 12:33 -0400
  Re: struct with one member: padding? John Gordon <gordon@panix.com> - 2012-06-27 16:40 +0000
    Re: struct with one member: padding? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-27 18:27 +0100
  Re: struct with one member: padding? Ben Pfaff <blp@cs.stanford.edu> - 2012-06-27 09:57 -0700
  Re: struct with one member: padding? China Blue Meanies <chine.bleu@yahoo.com> - 2012-06-27 12:15 -0700
    Re: struct with one member: padding? Andrew Cooper <amc96@cam.ac.uk> - 2012-06-27 22:52 +0100
      Re: struct with one member: padding? scott@slp53.sl.home (Scott Lurndal) - 2012-06-27 23:42 +0000
  Re: struct with one member: padding? William Ahern <william@wilbur.25thandClement.com> - 2012-06-27 18:03 -0700

csiph-web