public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: Jim Wilson <wilson@specifix.com>
To: Bartosz Wadolowski <bartosz.wadolowski@gmail.com>
Cc: gcc-bugs@gcc.gnu.org
Subject: Re: Bug in g++ 4.1.2 when using inline function definied in cpp file  but declared in h file
Date: Fri, 23 Mar 2007 00:46:00 -0000	[thread overview]
Message-ID: <46032341.50505@specifix.com> (raw)
In-Reply-To: <200703220139.41175.bartosz.wadolowski@gmail.com>

We don't track bugs reported via email.  If you want to make sure you 
get an answer, use the bugzilla database instead.  This doesn't seem to 
be a gcc bug though.

In C++, the inline keyword is similar to what "static inline" means in 
GNU C, i.e. only emit the function if it is used.  Since there is no use 
of the function in a.cpp, gcc does not emit it.  You can see this if you 
compile a.cpp with -S and look at the assembler output.

You can fix this by deleting the use of the inline keyword.  Or you can 
fix it by putting the inline function definition into the a.h file 
instead of the a.cpp file.  This way it will be visible in main.cpp when 
we call it, and then gcc will emit it.

Or you can fix it by using pragma implementation and pragma interface as 
you discovered.

I'm not a C++ expert.  There may also be other ways to fix this.
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com


      reply	other threads:[~2007-03-23  0:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-22  5:39 Bartosz Wadolowski
2007-03-23  0:46 ` Jim Wilson [this message]

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=46032341.50505@specifix.com \
    --to=wilson@specifix.com \
    --cc=bartosz.wadolowski@gmail.com \
    --cc=gcc-bugs@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: link
Be 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).