public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Deprecate -fpack-struct for C++?
@ 2004-02-20  3:03 Giovanni Bajo
  2004-02-23  7:08 ` Mark Mitchell
  0 siblings, 1 reply; 2+ messages in thread
From: Giovanni Bajo @ 2004-02-20  3:03 UTC (permalink / raw)
  To: gcc; +Cc: Nathan Sidwell

Hello,

-fpack-struct cannot be used correctly in average C++ code. v3 is totally
incompatible with it (you can't even include the headers without getting a flow
of errors related to taking addresses/binding references to packed members of
classes) and the option does not discriminate between system headers and user
code. Plus, it triggers a segfault, see PR 14173. We have two options:

- Deprecate -fpack-struct for C++. I'd like to deprecate it in 3.4 and remove
it from mainline. I guess it's not so widespread for C++ given the above issues
anyway. And we are not losing any semantic power since we still have attribute
packed anyway.

- Fix -fpack-struct to affect only user structures, so that it becomes usable
somehow. This could be done checking if the structure is declared in system
headers, or checking if the enclosing namespace is std (assuming that v3 code
has to sit in namespace std anyway).

Comments?
Giovanni Bajo


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Deprecate -fpack-struct for C++?
  2004-02-20  3:03 Deprecate -fpack-struct for C++? Giovanni Bajo
@ 2004-02-23  7:08 ` Mark Mitchell
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Mitchell @ 2004-02-23  7:08 UTC (permalink / raw)
  To: Giovanni Bajo; +Cc: gcc, Nathan Sidwell


> - Deprecate -fpack-struct for C++. I'd like to deprecate it in 3.4 and remove
> it from mainline. I guess it's not so widespread for C++ given the above issues
> anyway. And we are not losing any semantic power since we still have attribute
> packed anyway.

I would support deprecating -fpack-struct in C++.

(And in C for that matter!  It's much better to use attributes and/or 
#pragma pack.)

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-02-23  4:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-20  3:03 Deprecate -fpack-struct for C++? Giovanni Bajo
2004-02-23  7:08 ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).