Skip to content

Commit

Permalink
Merge pull request #40 from archfrog/master
Browse files Browse the repository at this point in the history
Added warning that this chapter is defunct and fixed a spelling error.
  • Loading branch information
f0rki committed Mar 21, 2022
2 parents a348424 + cbea67d commit 68b6afc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion exception-handling/listings/setjmp_longjmp.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; jmp_buf is very platform specific, this is for illustration only...
%jmp_buf = type { i32 }
%jmp_buf = type [ 5 x i32 ]
declare i32 @setjmp(%jmp_buf* %env)
declare void @longjmp(%jmp_buf* %env, i32 %val)

Expand Down
16 changes: 13 additions & 3 deletions object-oriented-constructs/multiple-inheritance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@ Multiple Inheritance
--------------------

Multiple inheritance is not that difficult, either, it is merely a
question of laying out the multiply inherited "structures" in order
inside each derived class.
question of laying out the multiple inherited "structures" in order
inside each derived class, while taking into consideration the
duplication of data members that are inherited multiple times.

WARNING:
This chapter is currently utterly bogus because it basically treats
the non-virtual multiple inheritance as it was virtual. If *you*
feel like finishing it up, please feel free to fork and fix. The
problem is that the `SetB()` and `SetC()` setters need to take into
account the offset of each of the *active* data members used in
`BaseB::SetB()` consideration somehow.

.. code-block:: cpp
Expand Down Expand Up @@ -44,6 +53,7 @@ inside each derived class.
}
private:
// Derived now has two '_a' members and one '_b' member.
int _c;
};
Expand Down Expand Up @@ -76,6 +86,7 @@ This is equivalent to the following LLVM IR:
%Derived = type {
i32, ; '_a' from BaseA
i32, ; '_a' from BaseB
i32, ; '_b' from BaseB
i32 ; '_c' from Derived
}
Expand All @@ -90,7 +101,6 @@ This is equivalent to the following LLVM IR:
And the compiler then supplies the needed type casts and pointer
arithmentic whenever ``baseB`` is being referenced as an instance

of ``BaseB``. Please notice that all it takes is a ``bitcast`` from one
class to another as well as an adjustment of the last argument to
``getelementptr``.

0 comments on commit 68b6afc

Please sign in to comment.