public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: "Igor A. Goussarov" <igusarov@akella.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c++/10332: Template classes are not instantiated correctly in presense of #pragma pack() Date: Mon, 14 Apr 2003 10:06:00 -0000 [thread overview] Message-ID: <20030414100602.4323.qmail@sources.redhat.com> (raw) The following reply was made to PR c++/10332; it has been noted by GNATS. From: "Igor A. Goussarov" <igusarov@akella.com> To: Momchil Velikov <velco@fadata.bg> Cc: ljrittle@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org Subject: Re: c++/10332: Template classes are not instantiated correctly in presense of #pragma pack() Date: Mon, 14 Apr 2003 14:02:26 +0400 Momchil Velikov wrote: >>>>>>"Igor" == Igor A Goussarov <igusarov@akella.com> writes: > Igor> Momchil Velikov wrote: > >> What is the scope of #pragma pack ? > > Igor> Apparently, from the line it is encountered at till the end of > Igor> translation unit or till the next #pragma pack. > > In that case holding it in a global variable looks appropriate, no ? Up to a certain degree, yes. The concept of "packing" is applied to structures, thus the packing size is a property of each structure. Holding it in a global variable is justifiable only if there's absolutely no chance that this variable could potentially be altered before it is used to create an internal compiler representation of the structure in question. I grant that C plain structures are "instantiated" immediately at the point of their definition. C++ templates are not. The compiler still have to store the last packing size in a global var (or a stack, to support #pragma push/pop). But as soon as a struct definition is encountered (whether a template or not), the value of that global var should've been copied to that structure description. And the compiler should later use the value from the structure description rather then from the global var. In other words, the global var only stores the current packing size and is used _solely_ to initialize the packing size of each new defined struct. As Loren has mentioned, #pragma pack came from C compiler, and probably its interference with C++ entities was not fully considered... By now, I'm most interested in figuring out the point of view of the gcc developers: do you tend to think that the current interference of #pragma pack and templates is an undocumented feature or an incorrect behaviour? Best Regards, Igor
next reply other threads:[~2003-04-14 10:06 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-04-14 10:06 Igor A. Goussarov [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-04-15 13:46 Igor A. Goussarov 2003-04-14 23:46 Loren James Rittle 2003-04-14 9:06 Momchil Velikov 2003-04-14 8:56 Igor A. Goussarov 2003-04-11 13:56 Momchil Velikov 2003-04-11 11:46 Igor A. Goussarov 2003-04-11 1:16 ljrittle 2003-04-07 10:46 igusarov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030414100602.4323.qmail@sources.redhat.com \ --to=igusarov@akella.com \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).