Thread View: gnu.g++.bug
3 messages
3 total messages
Started by Tom Keffer
Sat, 09 Sep 1989 23:51
static functions
Author: Tom Keffer
Date: Sat, 09 Sep 1989 23:51
Date: Sat, 09 Sep 1989 23:51
40 lines
1665 bytes
1665 bytes
Michael,
This goes back to an earlier discussion we had as to whether
-finline-functions should be the default. Consider the following:
#ifdef DEBUG
#define Inline static
#else
#define Inline inline
class Foo {
void bar();
};
Inline bar() { /* a definition */ }
This is how I have been using the inline qualifier: make it static if
you are debugging.
Now the problem. Cfront 2.0 squawks at this with the error "static
specified for qualified name bar()". If the definition is static,
the declaration must be static (in which case "this" is not defined
under 2.0), clearly not what we mean here. Personally, I think this
is stupid, but it's their compiler.
So, the choice is whether to make g++ compliant, or ignore the whole
thing.
A cavaet: I have not tested this myself because I do not have access
to a 2.0 compiler. It is being passed on by a user of my vector
package.
-tk
---
Dr. Thomas Keffer | Internet: keffer@sperm.ocean.washington.edu
School of Oceanography | BITNET: keffer%sperm.ocean.washington.edu@UWAVM
Univ. of Washington, WB-10 | uucp: uw-beaver!sperm.ocean.washington.edu!keffer
Seattle, WA 98195 | Telemail: T.KEFFER/OMNET
(206) 543-6455
Re: static functions
Author: Doug Schmidt
Date: Sun, 10 Sep 1989 00:32
Date: Sun, 10 Sep 1989 00:32
26 lines
1596 bytes
1596 bytes
In article <8909092351.AA14187@sperm.ocean.washington.edu>, keffer@SPERM (Tom Keffer) writes:
>Michael,
>
> This goes back to an earlier discussion we had as to whether
>-finline-functions should be the default.
>
This reminds me...
Here's another relevant entry from the newly updated documentation from
g++.texinfo:
----------------------------------------
@item -fdefault-inline
If this option is enabled then member functions defined inside class
scope are compiled inline by default, @emph{i.e.,} you don't need to
add @var{inline} in front of the member function name. If this option
is not enabled GNU C++ will not inline member functions by default.
----------------------------------------
Doug
--
schmidt@ics.uci.edu (ARPA) | Per me si va nella citta' dolente.
office: (714) 856-4043 | Per me si va nell'eterno dolore.
| Per me si va tra la perduta gente.
| Lasciate ogni speranza o voi ch'entrate.
static functions
Author: Michael Tiemann
Date: Sun, 10 Sep 1989 02:07
Date: Sun, 10 Sep 1989 02:07
24 lines
1096 bytes
1096 bytes
Date: Sat, 9 Sep 89 16:51:31 PDT
From: keffer@sperm.ocean.washington.edu (Tom Keffer)
Michael,
This goes back to an earlier discussion we had as to whether
-finline-functions should be the default. Consider the following:
#ifdef DEBUG
#define Inline static
#else
#define Inline inline
class Foo {
void bar();
};
Inline bar() { /* a definition */ }
Is what you really mean ``Inline void Foo::bar ();''. If so I don't
see a problem with just #defining ``Inline'' to nothing, since the
return type will save your function from not having a return type.
Michael
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads