Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
0ded1f18
Commit
0ded1f18
authored
26 years ago
by
Jason Merrill
Committed by
Jason Merrill
26 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* extend.texi (Bound member functions): Document.
From-SVN: r24483
parent
02275c91
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletions
+42
-1
gcc/ChangeLog
+4
-0
gcc/extend.texi
+38
-1
No files found.
gcc/ChangeLog
View file @
0ded1f18
Mon
Jan
4
11
:
55
:
51
1999
Jason
Merrill
<
jason
@yorick
.
cygnus
.
com
>
*
extend
.
texi
(
Bound
member
functions
)
:
Document
.
Mon
Jan
4
11
:
01
:
48
1999
Kaveh
R
.
Ghazi
<
ghazi
@caip
.
rutgers
.
edu
>
*
mips
-
tdump
.
c
(
st_to_string
,
sc_to_string
,
glevel_to_string
,
...
...
This diff is collapsed.
Click to expand it.
gcc/extend.texi
View file @
0ded1f18
@
c
Copyright
(
C
)
1988
,
89
,
92
,
93
,
94
,
96
Free
Software
Foundation
,
Inc
.
@
c
Copyright
(
C
)
1988
,
89
,
92
,
93
,
94
,
96
,
99
Free
Software
Foundation
,
Inc
.
@
c
This
is
part
of
the
GCC
manual
.
@
c
For
copying
conditions
,
see
the
file
gcc
.
texi
.
...
...
@@ -3015,8 +3015,11 @@ Predefined Macros,cpp.info,The C Preprocessor}).
declarations and definitions.
* Template Instantiation:: Methods for ensuring that exactly one copy of
each needed template instantiation is emitted.
* Bound member functions:: You can extract a function pointer to the
method denoted by a @samp{->*} or @samp{.*} expression.
* C++ Signatures:: You can specify abstract types to get subtype
polymorphism independent from inheritance.
@end menu
@node Naming Results
...
...
@@ -3476,6 +3479,40 @@ be the same in all translation units, or things are likely to break.
more discussion of these pragmas.
@end enumerate
@node Bound member functions
@section Extracting the function pointer from a bound pointer to member function
@cindex pmf
@cindex pointer to member function
@cindex bound pointer to member function
In C++, pointer to member functions (PMFs) are implemented using a wide
pointer of sorts to handle all the possible call mechanisms; the PMF
needs to store information about how to adjust the @samp{this} pointer,
and if the function pointed to is virtual, where to find the vtable, and
where in the vtable to look for the member function. If you are using
PMFs in an inner loop, you should really reconsider that decision. If
that is not an option, you can extract the pointer to the function that
would be called for a given object/PMF pair and call it directly inside
the inner loop, to save a bit of time.
Note that you will still be paying the penalty for the call through a
function pointer; on most modern architectures, such a call defeats the
branch prediction features of the CPU. This is also true of normal
virtual function calls.
The syntax for this extension is
@example
extern A a;
extern int (A::*fp)();
typedef int (*fptr)(A *);
fptr p = (fptr)(a.*fp);
@end example
You must specify @samp{-Wno-pmf-conversions} to use this extension.
@node C++ Signatures
@section Type Abstraction using Signatures
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment