Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | John Gordon <gordon@panix.com> |
|---|---|
| Newsgroups | comp.lang.c, comp.unix.programmer |
| Subject | Re: struct with one member: padding? |
| Date | 2012-06-27 16:40 +0000 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Message-ID | <jsfd2q$r2u$1@reader1.panix.com> (permalink) |
| References | <jsfckr$drq$1@speranza.aioe.org> |
Cross-posted to 2 groups.
In <jsfckr$drq$1@speranza.aioe.org> "Mark" <mark_cruzNOTFORSPAM@hotmail.com> writes:
> 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.
If you're accessing in_addr.s_addr, why do you care if there is padding
before or after?
If you're trying to access in_addr as though it were not a struct I can
see why you would care, but that seems to be a pretty egregious error.
--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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